Low Search: output list of searched collections in results
I have 7 collections and a set of search form options that allow the user to search all of them or pick from a checklist.
In my results page I can report on the search term easily enough with {low_search_keywords} but I can't see a way to report back a confirmation of which collections were searched if the user hasn't chosen the (defaullt) all option.
I note there is a collections tag but that isn't sensitive to the search options that were chosen.
Having been able to use other support threads here to get Low Search working with GET variables on my EE installation, clearly an option is for me to use JavaScript to parse the collection URL parameter and append my HTML but it would be nice if I didn't have to!
Or have I missed something?
Replies
Jonathan Schofield 2 Jul 2013 09:20
Just spotted the {low_search_param} variable which nearly gets me what I want with {low_search_collection} but that produces a pipe separated list of collections as they appear in the URL.
What would be great is if there were a way to change the delimiter so I could do something like...
{total_results} match{if total_results > 1}es{/if} found for ‘<strong>{low_search_keywords}</strong>’ in {low_search_collection delim=", " backspace="2"}.
To produce output like...
It would be even nicer if when the searched collections parameter equates to all collections, instead of listing all of them, it simply resulted in...
Perhaps the word ‘all’ could be an admin definable setting so people could, for example, choose ‘everywhere’ or ‘everything’.
Jonathan Schofield 2 Jul 2013 09:30
I forgot to say... Low Search is bloody brilliant and fantastic value for money!
Low 2 Jul 2013 10:55
Hi Jonathan,
Good to see you're liking Low Search. :)
As for your question: if you performed a keyword search, you'll get a single collection per entry: the {low_search_collection_[id|label|name]} variables.
Multivalued search parameters are always returned as a pipe-separated list. With that, you can use the special conditionals to display only the ones you need. In your case, you could use this:
Jonathan Schofield 2 Jul 2013 12:11
Excellent, thanks. Guess this thread is now a question rather than an idea!