Using multiple search terms, matching any
Hi there,
I'm using this search-form:
{exp:low_search:form channel="products" query="{segment_2}" search_mode="any" loose_ends="both" result_page="{segment_1}/search"}
{/exp:low_search:form}
Now, when I'm entering one search term at a time it's working, but as soon as I start typing two or more terms, there are no results shown.
I want to be able to enter "red green blue" and have all entries listed, containing one of these or more in the specific field.
What am I doing wrong?
Replies
Low 16 Jun 2014 13:07
Setting Filter parameters (in your case: channel, search_mode, loose_ends) to the Form tag doesn't do anything in LS3. Either set them to the Results tag or use a hidden input fields in the Form.
Heiko 16 Jun 2014 13:12
Alright, thanks for clearing that up! And man you're fast! :)
I've put those parameters to the results tag, but it still doesn't work as intended.
Can you please point me to an example?
Low 16 Jun 2014 13:17
Can you share the actual form? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.
Heiko 16 Jun 2014 13:24
Here's the field I'd like to be able to enter multiple terms into.
It's a two column matrix-field containing the languages a member speaks and his level of proficiency (col: language_select | col: language_proficiency):
http://pastie.org/9295014
And this is the results tag:
http://pastie.org/9295018
Low 16 Jun 2014 14:09
Instead of name="search:member_language", use name="keywords" so you trigger the Keywords filter. Also make sure you have a Collection set up for that channel.
Heiko 16 Jun 2014 14:16
Awesome support, this works! Thank you very much. :)
Heiko 17 Jun 2014 05:37
Sorry to rehash this again, but I've noticed, that this only works, when I set name="keywords" to one field only.
I've setup a collection per input containing the relevant fields only (languages, skills) and I'm using the following inputs:
http://pastebin.com/raw.php?i=nr8w9R1g
Now, while the second input works as expected, I can enter any gibberish into the first and it still returns all of my entries all the time.
I want to be able to enter multiple terms and have the search return all relevant entries matching those terms (e.g. english AND german AND russian or dancing AND cooking AND coding).
Low 17 Jun 2014 08:05
I'm afraid the Keywords filter doesn't work like that.
First of all, having 2 input fields with the same name="" attribute won't work, as only the latter will overwrite the former.
Secondly, setting collection="foo" on a HTML input field has no effect. It's HTML. Not an EE tag.
Instead, use a single input field with name="keywords" and either target both collections, or use a drop down to let the user select the collection he/she wants to search through.