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 7 years, 3 months ago.
- AuthorPosts
- November 30, 2016 at 11:19 am #11033
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,
PatrykNovember 30, 2016 at 11:25 am #11034Hi 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 :)
November 30, 2016 at 11:30 am #11036Thank you for your answer.
As we have several Custom Fields is there any option to divide them, we have for example:
– Author
– Full textWe would like the author to be much more relevant than Full text.
Is this possible in the Index Table Engine?November 30, 2016 at 2:29 pm #11055Unfortunately 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 :)
December 1, 2016 at 1:09 pm #11075This 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!December 1, 2016 at 1:15 pm #11079You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Relevance search based on custom fields value’ is closed to new replies.