Skip Navigation

[Resolved] Give more weight to the post title compared to the post content in custom searches

This thread is resolved. Here is a description of the problem and solution.

Problem:
A View with text searches returns results where the search term is found only in the body and not the title, and the client wants to give higher weighting to the title.

Solution:
Views text searches builds on standard WordPress queries and so simply detects whether the string is present or not. You can specify whether to include just the post title, or both the title and the content, but not assign weights to them.

For that you would need to add a specialised search plugin.

Relevanssi (https://wordpress.org/plugins/relevanssi/) includes such weighting, and has the additional benefit that it is integrated with Views searches so that you can include text from your custom fields in the searches, too.

Relevant Documentation:
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#619549

I have a custom search which you can see at the link below.

hidden link

How can I make the search prioritize the title over the description.

In the search above, you can see that if one searches for "paul" most of the results do not contain the word "paul" in the title.

Thanks in advance!

#619616

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Amin

Views text searches builds on standard WordPress queries and so simply detects whether the string is present or not. You can specify whether to include just the post title, or both the title and the content, but not assign weights to them.

For that you would need to add a specialised search plugin.

Relevanssi (https://wordpress.org/plugins/relevanssi/) includes such weighting, and has the additional benefit that it is integrated with Views searches so that you can include text from your custom fields in the searches, too.

https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/