3

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?

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, privacy policy and cookie policy

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