Skip Navigation

[Resolved] Is there a way to add two search boxes with a content field as a "AND" condition

This support ticket is created 3 years, 7 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
- 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 3 replies, has 2 voices.

Last updated by Minesh 3 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2406711
화면 캡처 2022-06-28 143300.png

Is there a way to add two search boxes with a content field as a "AND" condition?
At the moment it is not working. (See Screenshot)
Please let me know if there is another way.

#2406937

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

It seems you want to use a text search with two different text box and in addition to that you want to apply "And" clause between the keywords added to those two text boxes - is that correct? If yes, there is no native way to add such but you may customize it by adding some custom code.

If you can share real example with problem URL and access details and tell me example text for textbox1 and textbox2 and on what post type you want to apply the search (basically if you can share whole idea about using two textboxes and what should be your end result) that would help me to share workaround if I have any.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2407531

The current site requires two text boxes of "AND" conditions. However, this site is not a complete version, so it may be necessary for other pages in the future. So if you tell me how, I'll follow you.

#2407609

Minesh
Supporter

Languages: English (English )

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

But that is what I'm saying, there is no option to add two search textboxes and apply and clause between them.

Here is the doc about how you can build text search with Toolset:
- https://toolset.com/documentation/user-guides/views/filtering-views-for-a-specific-text-string-search/

And the following Doc it integration of text search with "relevanssi":
- https://toolset.com/course-lesson/searching-texts-in-custom-fields-with-toolset-and-relevanssi/

You may have to add another textbox search manually and change its name and ID and then you can use some filter hook to apply "and" condition between the input value for those textboxes that may require custom code which is beyond the scope of our support policy.

But if you have any specific requirement and you can tell on what entity you want to apply the search (you want to search in post title and content or even in custom field), how you want that the search you aim should work?