Searching custom fields
Is it possible to search custom fields for specific values? I'm trying to do this using the search channel parameter as one of my form fields. In this case a select list. When I try to perform a search with one of the selected options, I get a Disallowed Key Characters error.
Here is how I have my form setup:
{exp:low_search:form collection="applications" search_mode="all" result_page="rfps/results" form_id="rfp-search"}
< select name="search:cf_app_project_zone=" >
< option value="" >Zone</option >
< option value="" >Texas Zone< /option >
< option value="" >Pacific Zone< /option >
< /select >
{/exp:low_search:form}
Replies
Low 5 May 2011 21:10
Hey Casey,
Try changing "search:cf_app_project_zone=" to "search:cf_app_project_zone", without the equal to sign in the quotes. Does that help?
Casey Reid 6 May 2011 13:56
If I remove the = sign I no longer get the Disallowed Key Character error, but it also doesn't perform the search. It just redirects right back to my search index page instead of to my results template. Using a keyword search works just fine. It's just whenever I try to search on the custom field. I'm using the latest version of Low Search and EE 2.1.3.
Low 6 May 2011 14:07
It is intended behaviour that you are redirected back to the search form if no keywords are posted. Am I right in understanding that you only want to use the dropdown, not the keywords?
If that's the case, I might need to think about how to best handle this. The whole idea about Low Search is to use keywords to get results, and optionally filter them by any parameter. Thinking pragmatically, you could add a hidden keywords field and populate that with the value of the dropdown with javascript, before the form is submitted.
Casey Reid 6 May 2011 15:51
Ah, that makes sense. My intention was to use either the dropdown custom field or keyword search independently of each other. In some cases I would use them together as well.
I like the keyword approach and understand your logic behind that. In this particular scenario, having the custom field as a dropdown is a necessity. Your JS solution should work though. I'll explore that route for now.
Thanks for the suggestions and help.
Low 6 May 2011 16:03
You're welcome. I'll add the keyword-less search to my 'to investigate' list.
James 5 Sep 2011 17:21
Hi Low,
If you can move the "keyword-less search" from your "to investigate" pile to your "feature request" pile I will love you forever (or till I ask for help again).
Basically on many document/publication search sites you can search on keyword AND category, or just keyword, or just category. This is nice as then you can either search or "filter" from the same form interface. I have a category list as well, but some people just use this workflow (including myself). Please seriously consider this addition.
Heck I'd take a wildcard "*" search option at least and I could put instructions in to search on wildcard + category.
Additionally I'd be happy to buy you lunch if you decide to add it in the next week or so :D (Can't blame me for trying)
Low 5 Sep 2011 21:50
Hey James,
I do understand the added value of a keyword-less search option, so I will do my best to add it as a feature. I does require some pretty significant changes, so I won't make next week, I'm afraid. :)
Amit 21 Sep 2011 07:20
Hey low,
Planning to invest in your search plugin and I need this feature too. Is this feature ready?
Low 21 Sep 2011 07:25
Hi Amit,
I'm working on this update as we speak, and I should be able to release the update this month.
James 21 Sep 2011 15:44
Awesome to hear Low, thank you!
Low 27 Sep 2011 20:56
Version 1.0.6 supports keyword-less searches.
James 4 Oct 2011 02:40
Just installed and tried out the latest update Low, thanks so much for adding this feature, it really makes the product more useful! I hope I see you at the EECI conf. in NYC so I can buy you a beer.