Relevance search based on custom fields value

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Relevance search based on custom fields value

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #11033
    expromo
    expromo
    Participant

    Hello,

    We are using custom fields in our search and they are a crucial part of our search results.

    We can’t see any option to add them to relevance which is a big issue for us (we have some custom fields that are more important than content for example).

    Please let us know (we can do this via functions.php) how we can add custom fields to search relevance.

    Best regards,
    Patryk

    #11034
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Patryk,

    For the Regular Engine the custom fields have no relevance values for performance reasons. If you prefer to adjust the relevance, I suggest using the index table engine instead, and then you can configure the custom field relevance weight as well on the Relevance Options -> Index table panel: https://i.imgur.com/BOunh7t.png

    Best,
    Ernest Marcinko

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


    #11036
    expromo
    expromo
    Participant

    Thank you for your answer.
    As we have several Custom Fields is there any option to divide them, we have for example:
    – Author
    – Full text

    We would like the author to be much more relevant than Full text.
    Is this possible in the Index Table Engine?

    #11055
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Unfortunately not, the index table is not designed to store relations of custom fields, only the words.

    With the regular engine it might be possible with some major modifications, but I’m not sure about that either. You could maybe try adding the following code to line 607 (should be an empty line) in file wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-cpt.php

    It should look like this after editing: https://i.imgur.com/itX1Lc1.png

    Just change the “author_field_name” and the “fulltext_field_name” to the custom field names.

    Please not that I have not tried this code! So be careful.

    Best,
    Ernest Marcinko

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


    #11075
    expromo
    expromo
    Participant

    This is awesome.
    The code you provided works perfect.

    I’m aware that it’s not a clean solution to edit core files, but it does the job.
    Thank you very much!

    #11079
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


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

The topic ‘Relevance search based on custom fields value’ is closed to new replies.