Searching solspace tags...
I'm trying to find entries tagged with Solspace Tag. My results tag looks like below, but most of the time nothing is found. I'm setting a stash variable with the search terms delimited with a "+". I suspect I'm doing something wrong...
------------
{exp:low_search:results query="{segment_2}" tag_name="{exp:stash:get name="searchterms-tags"}"}
My template code here...
{/exp:low_search:results}
------------
What I would like to do is to search my custom fields as well as the tags and return results if either are matched.
Best Regards,
Matts
Replies
Low 2 Jan 2015 15:00
This will be due to parse order, since you're using a (Stash) tag for another tag's parameter value. Try setting parse="inward" to the Results tag to make sure EE's template parser parses the Stash tag first.
Matts Härsing 2 Jan 2015 15:33
Ok, thanks. Still not getting any hits though.
Does the "tag_name" parameter actually do a search or does it just filter the results returned by the "query" parameter. If it is just a filter I will not get any results if the keyword(s) are only present in the tag(s) of an entry and not in any of the other custom fields. Correct?
Low 2 Jan 2015 16:01
All parameters in the query and tag itself are combined into a single search query (which consists of multiple consecutive mysql queries, but that's beside the point).
You'll also need to change the Stash tag so it uses single quotes instead of double quotes, or else EE's template parser will choke. So: tag_name="{exp:stash:get name='searchterms-tags'}"
You can also turn on template debugging so you can better see what's going on.
Matts Härsing 2 Jan 2015 21:56
Got it working. Thanks a lot!