Custom Fields Weighting

This topic contains 3 replies, has 2 voices, and was last updated by

3 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #19854


    I would need to weight custom fields. I am using the search for a glossary. So my posts have e.g. Abbreviations and Synonyms as custom fields.

    So for example in case a Synonym were an exact match I would that ordered before results were the same match is only in the content.

    How can this be done?



    Hi Michael,

    For performance reasons the custom field weight is disabled for the regular engine. There are two possible options in this case:

    1. Is to use the index table engine, however it is worth noting, that exact matching multiple keyword phrases (aka the whole field as one) is not possible, only separate whole words. This documentation can help you set up the index table, and then under the relevance options you will be able to change the custom field relevance to a much higher value.

    2. To make a direct modification to the regular search file to enable custom field matching relevance. To do that, you will have to
    – Open up the wp-content/plugins/ajax-search-pro/includes/classes/search/class-asp-search-cpt.php file on your server
    – and replace it’s contents with this.
    Please make sure to have a back-up of everything, before making direct changes. This change unlocks the custom field relevance query, and increases the result relevance, when a match is found within the choses custom fields. (chosen under the General Options -> Sources panel)

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    Hi Ernest,

    I replaced the content as specified by you. I assume that I should see a new column in the relevance tab. But nothing changed see screenshot. Or am I looking in the wrong place?

    Best Michael

    You must be logged in to view attached files.


    Make sure that the index table engine is indeed activated. Otherwise the other tab will stay disabled.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.