Skip Navigation

[Resolved] Text search won’t look into custom post types fields

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

Problem: I would like text searches to include custom field values.

Solution: Install Relevanssi and add these custom fields to the search index.

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

This support ticket is created 6 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Mario Hernandez 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1156449
Captura de pantalla 2018-11-30 a las 19.14.37.png

Hello! I am trying the main search box for the view to search into all the custom types.

The view is rendered in this page: hidden link
You can edit the view here: hidden link

As you can see, when you search for "portugal" you won't see any result, althought there are plenty of them with the custom field country "portugal".

You can see that I select "Posts content and title".

I would need help with this,

Thank you ,

Mario

#1157255

Hi, If you want search to check custom field values, you must install and configure Relevanssi as described here:
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

#1158647

Thank you Christian. That mainly solved the situation.

However, now we have the problem that we have to order the results of the search based on a custom field, and the system alerts us "Since you are using a text search with Relevanssi, the order of results may be according to relevance and not according to this selection. If the visitor searches by text, the results will be ordered by relevance."

We need the order to be maintained based on the custom field that we stablished, and the search box to allow us to search in the custom fields and show the results in that very order.

Is there any possibility to make this real?

thank you very much, again,

best,

Mario

#1158775

Not with Toolset, but you can use Relevanssi PHP filters to modify the sort order:
https://www.relevanssi.com/user-manual/relevanssi_hits_filter/

#1162903

My issue is resolved now. Thank you!