I'm retrieving a list and ordering it by a custom field but need to exclude some fields and include others. Essentially it is a case of the EE 'search by custom field' param but using OR not AND....was previously doing this without Stash with Mark Croxton's Search Fields module which unlike native EE does support an 'OR' search.

My question is - how can I replicate this on the Stash list? Is it possible to use Search Fields with Stash? From what I have so far seems not.

1 Answer 1


EE does support OR matching with the channel entries tag parameter:


If that's not enough:

Filtering a Stash list with regular expressions

You can create your own index column when capturing a resultset as a list. Your index column would concatenate the values you want to filter by.

Cache the list so that you don't need to re-run expensive channel:entries queries each time the template is viewed. I'm using '@' as a delimiter for the index column:

{exp:stash:set_list name="cars" parse_tags="yes" limit="500" save="yes" scope="site" replace="no"}
    {exp:channel:entries channel="cars"}

{!-- get red OR blue AND volkswagen --}
{exp:stash:get_list name="cars" scope="site" match="#^(blue|red)@volkswagen$#" against="index"}
   {reg} <br>

{!-- get red OR volkswagen --}
{exp:stash:get_list name="cars" scope="site" match="#^red@|@volkswagen$#" against="index"}
   {reg} <br>


Outputting more than a few hundred entries with channel entries will be expensive in memory and queries the first time your template is viewed and the cache generated. You could write your own optimised query to grab the relevant entries, or if you are trying to filter a large resultset, consider using something like the excellent Low Search.

  • Hi Mark, thanks for answering so quick. I think I was a bit unclear in my first post, I meant EE was not allowing an OR between two different fields {exp:search_fields search:field1="={segment_3}" search:field2="={segment_3}" operator="OR" channel="scheduler_times" parse="inward"}'
    – segovius
    Commented Feb 11, 2014 at 19:11
  • Ah, right. What problems are you having capturing search_fields in a stash list btw? Commented Feb 11, 2014 at 19:14
  • Not so much problems as such, just can't work out how to replicate the search on the 2 distinct custom fields with an OR like in the Search Fields module. Thanks for the above btw I'm going to try this now, I really only need to filter about 10-20 entries max so I don't think the overhead should be too bad. PS: sorry for all the edits, not sure why it kept submitting before I'd written.
    – segovius
    Commented Feb 11, 2014 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.