4

I am using Drupal 7.43 and core search module.

I use "Search: Search Terms" for filter criteria and "Search:Score" Sorting criteria in my view to sort my results according to relevance.

But, for example if I search for text "drupal view search" it prioritize some node containing word "drupal" 5 times over a node containing all the text I entered, "drupal view search".

I want to sort my results such that, prioritize nodes that have title as the text I entered,then nodes that have any of the words in title, then nodes that have that text in the body.

How can I customize and add more functionality to the content ranking part in this page /admin/config/search/settings?

4
  • Is there a reason you are not using the search api module? Commented Jun 27, 2016 at 15:42
  • I did not see anything to help me customize relevance in search api, can you give an example or at least direct me? Commented Jun 28, 2016 at 5:35
  • This is a basic Search API tutorial webwash.net/drupal/tutorials/… It should tell you how to manage fields and set priority for custom searches. Commented Jun 29, 2016 at 6:08
  • Did the search api help? Commented Jul 5, 2016 at 16:19

1 Answer 1

2

Drupal core's search can't really do this. You'll need to use something like the Search API contrib module (https://www.drupal.org/project/search_api).

Search API allows you to plug in different backends ("servers") for the search database. I have the most experience with Solr, rather than the "database" backend. Solr, for sure, lets you not only choose which fields get indexed, but also how much relevance each field is awarded when a search matches. That is, you can say to index the title of the node as a Fulltext, with a score (weight) of 5, but index the body as Fulltext with a weight of 4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.