Searching Specific Collections
On my current project, I'm trying to finish a search feature for medical providers. The client offers three plans (Plans A-C) where providers come from two directories (Directory 1 and 2).
Plan A = Directory 1
Plan B = Directory 1 OR Directory 2
Plan C = Directory 1 OR Directory 2
To set up my search form, I'm using two dropdown menus which are outside Low Search and direct visitors to specific pages. For example:
http://example.com/search/plan_a
http://example.com/search/plan_b/dire...
http://example.com/search/plan_a/dire...
In my EE configuration, Directory A is one channel (Providers A) and Directory B is another channel (Providers B). In Low Search 4, I have two collections, one for each channel.
The {exp:low_search:form} is in an embed called by various conditionals in the search/index template with embed parameters to populate lists of provider specialities (which differ between the two directories). I was hoping to be able to use the collections= parameter in the search:form tag past versions of Low Search appeared to offer and be done with this. In the docs / examples, I'm not seeing a way to specify a collection in either the form or results sections.
Let me know if you want to see specific code blocks / need more details.
Thanks
Replies
Low 29 Jan 2016 08:53
As explained here: parameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag. That goes for the collection parameter as well.
So, to use it inside a form, add something like this inside your Form tag:
Or, hardcode the collection in the Results tag, like so:
If you want to make it depend on the URI, then replace plan_a with {segment_2}.
Brooks Seymore 29 Jan 2016 19:32
The input solution worked.