Skip Navigation

[Gelöst] Keyword search through custom field type checkboxes

This support ticket is created vor 3 Jahre, 7 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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+01:00)

This topic contains 21 Antworten, has 2 Stimmen.

Last updated by zeljko-turkaljS vor 3 Jahre, 6 Monate.

Assisted by: Nigel.

Author
Artikel
#1783209

Hi all,

I have one question. Is it possible to keyword search through custom field type checkboxes? This isn't working for me, can you please check this demo form: hidden link

Listing Title is single line (keyword search is working), Listing Description is Multiple lines (keyword search is working ) and Listing Industry is checkboxes type (keyword search not working). For example client wants to have ability to search by NAICS code, for example to search for NAICS 447 industry code. The first listed listing has this industry type, this code.

Here is the filter for Industry field: hidden link

Can you please advise
Thanks

#1784103

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

If I've understood you correctly, you want the users to be able to perform a free-form search (i.e. type in the search text rather than choosing from drop-down filters).

Views only supports a single text search input, which can be used to search the post title, the post content, and custom fields at the same time (rather than individual searches for each).

Support for searching custom fields requires the Relevanssi plugin, and you must set the options to include the custom fields in the index. See https://toolset.com/documentation/user-guides/views/searching-texts-custom-fields-views-relevanssi/

Note that for checkboxes fields they must be set up such that the value stored includes the required text (rather than simply being the label for the checkbox option).

#1785173

Hi Nigel, thanks for your quick response.

If I've understood you correctly, you want the users to be able to perform a free-form search (i.e. type in the search text rather than choosing from drop-down filters).
Yes, exactly.

Views only supports a single text search input, which can be used to search the post title, the post content, and custom fields at the same time (rather than individual searches for each).
That's exactly what I want to accomplish, I only want to have free form search on field Industry (field type checkboxes), and this is not working. I added tree fields just to show you how free form search is working on post title, on post description (multilines) but not on the field type checkboxes. I will not have tree free form search fields, only one, trough Industries.

Note that for checkboxes fields they must be set up such that the value stored includes the required text (rather than simply being the label for the checkbox option).
Here are they, but still not working
hidden link
Title is: Agriculture, Forestry, Fishing and Hunting (NAICS 11)
Value to store: Agriculture, Forestry, Fishing and Hunting (NAICS 11)

Can you please advise, maybe login can help?
Sasa

#1785353

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

Hi Sasa

Are you using Relevanssi and you followed the steps to include the custom fields in the Relevanssi index and created the index?

#1785377

Hi Nigel, I have, here it is

plugin: hidden link
indexing: hidden link
custom post type in relevanssi: hidden link

Sasa

#1786039

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

And you included custom fields when indexing? (That's not shown in your screenshots.)

If you use the normal site search (which Relevanssi will manipulate) rather than a View search does that return the expected results when searching for the checkboxes custom field values?

Let me take a look at your site.

I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

What page have you added the search View to?

#1787337

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

Screenshot 2020-09-23 at 10.55.33.png
Screenshot 2020-09-23 at 10.56.59.png

In the Relevanssi settings it shows that for the Listing post type it is set to be excluded from search results (that's actually in your screenshot).

There is also a warning about that on the searching tab of the Relevanssi settings (screenshot).

At Toolset > Post Types the Listing post type has the option to exclude from search checked (screenshot). That's not the default, it would have been chosen.

Naturally, with the above settings Listings won't be included in search results.

#1787549

Hi Nigel, I fix everything you stated above, rebuild the relevanssi index structure, but I still don't have results in Industry keyword search (third input field -> Keyword search trough listing industries). Please check and advise

hidden link

Sasa

#1787553

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

Sorry, I see you have set up separate filters for the title, description, and GABB Industry custom fields and are not using text search (or Relevanssi) at all.

You are filtering the fields directly, using a text input instead of the more typical select dropdown for example. That means you would need to enter the exact text match of what you are searching for, and that is not feasible, I don't think.

I suggest you remove those filters altogether and insert one text search filter, set to search title, content, and custom fields. These results will be based on the Relevanssi index.

So you'll have a single text search box where a user might enter "NAICS 447" for example, and the results will find any post that has that in the title, content, or custom field.

#1787859

Hi Nigel, as you stated above, I removed all search field and added just one, please check following link:

hidden link

This form is embedded to hidden link, I can search by title, by description, by location, but still not getting any results for Industries. Is this maybe really Checkbox issue?

Please advise
Thanks, Sasa

#1788523

Nigel, I just realized that GABB Location field is searchable (in some cases) and this is the same field type as GABB Industry.

Please check this: hidden link

And here is the small video: hidden link

Thanks, Sasa

#1788865

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

I triple-checked with a brand new local test site that searching for checkboxes custom fields with Relevanssi does work, but I can see that it is not working on your site.

I just noticed something odd on your site, though, and I wonder if it is connected.

Rather than use the Views search, I tried just using the native WordPress search, which Relevanssi affects, but when I tried visting hidden link it gave me a 404 error. So something on your site is disabling the native search?

Before going any further, let's check for conflicts.

Disable all plugins except Toolset and Relevanssi, and make sure you are not running any custom code (if you edited the theme's functions.php file, switch theme to twentytwenty, and disable any code snippets added in Toolset > Settings).

Now try the search again, does it work? If so you should be able to determine the source of any conflict that triggers the problem by a process of elimination.

#1788957

Here it Nigel, with Relevanssi disabled, native search then works: hidden link

Any suggestions?
Sasa

#1788963

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

I'm no longer able to access the backend to look at what you've done, it says I'm not allowed to see that page.

#1789009

Sorry, here it is, you are admin

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.