Skip Navigation

[Resolved] Relevanssi – repeatable custom fields

This support ticket is created 4 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by Minesh 4 years ago.

Assisted by: Minesh.

Author
Posts
#2146769

I want to use the classic wpv-filter-search-box within a classic wordpress archive to allow users to find what they are looking for. I have a few - also nested - repeating field groups with reveral repeating fields. Unfortunately I'm not be able to extend the search to this repeating fields groups. I understand that repeating field groups are different (child) post types which are connected to the parent post types. I followed this topics:
https://toolset.com/forums/topic/relevanssi-repeatable-custom-field/
https://toolset.com/forums/topic/repeatable-group-field-in-relevanssi-search/

to find a solution for me, but unfortunately I still get no results (parent posts) which contains the repeating field search terms.

I already did this: From WP Admin -> Relevanssi -> Indexing, I selected the repeating field group post types and also selected "some" for the custom fields option, so that individual custom fields can be included in the indexing. In the field for the custom fields, I added the field slugs with prefix "wpcf-". The repeatable field group post types are set to be excluded from the search results, by default. To overcome this, I unchecked the option "Respect exclude_from_search" from WP Admin -> Relevanssi -> Searching.

So, now I'm a little bit desperate. The only way I did not try so far is described here: https://toolset.com/forums/topic/searching-keywords-from-repeating-field-group-is-not-working/page/2/#post-1152641

The reason is easy. I don't understand it. Is it necessary to put the wpv-conditional along the (potential) results? And how should I do this?

Your support is really much appreciated. Thank you!

#2147273

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Have you set your view to query the repeating field group? if yes, Can you please share problem URL where you added the view as well as admin access details and on what fields you want to add the Relevanssi search?

#2147339

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Is this the correct profile archive you are talking about? hidden link

#2147345

Yes, this is profile archive I was talking about.

#2147451

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that within the archive we do not support the repeating field group search or nor using views.

The reason is repeating field groups are managed as child post type and technically the view/archive should be set to search to specific post type (where repeating field group internally treated as the child post type and to search within the repeating field group field you will require another view).

Archive meaning is to search within the specific post type archive we can not attach there another post type.

Another workaround would be to create a view and that view should be set to query the profile post type and you should create a page and add this view to that page. But as you are using the relevanssi, once you perform the search the search query will be handled by relevanssi not Toolet, we are just passing the search params to relevanssi hense I do not thing we will modify the search query to include the repeating field group post type.

All in all, we do not advise and its not natively possible as It's a limitation that you can not build a custom search that should search in parent and child post type at a time.

#2147505

Hi Minesh, thanks for checking out! To be honest, I am very surprised by your answer. Because it means that we can't create a reasonable search with toolset. It is definitely a blatant limitation of repeating field groups. I wonder why this issue has never been addressed by anyone else or how others have solved it. Ist this such a special case?

If I understood you correctly, there are only two ways now: to build a page that contains a view and search with the normal wordpress search (and not Relevanssi). Or to work without repeating field groups and try to store the information in the normal post type. Is this correct? Are you quite sure, that there is no other solution?

(Frankly, our whole project is on the back burner right now and over a year of work).

#2147529

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If I understood you correctly, there are only two ways now: to build a page that contains a view and search with the normal wordpress search (and not Relevanssi).
==>
You need to build a page that contains a view including the search with relevanssi and you may need to use the pre_get_posts hook or any other hook belongs to relevanssi that should be triggered before search query is fired to fetch all posts with the search keyword and based on the found repeating field group posts we need to return the parent posts. Also you will have to set your view's search settings to use the URL param rather AJAX as to search Within the repeating field group fields we may require to get search keyword from URL param.

Or to work without repeating field groups and try to store the information in the normal post type. Is this correct?
==>
If you store all content to normal post type, then it will be really easy and in that case you do not have to create another page and post, as all custom fields belongs directly to post that you set to query the archive you can easily build custom search.