How to filter by multiple fields


I’m using the MetaMagik plugin to define custom fields in my tasks (Reviewer and Owner). However, I’m unable to create a filter that gathers all of the tasks that a user is responsible for - ones that they are the Assignee on, as well as the Reviewer (the custom field).

For instance, I can get all of the tasks that the user is the Assignee of with:

status:open Assignee:<USER>

However, if I try to include also the fields which the user is marked as the custom field Reviewer, I am not able to.

Is there some filter that I can use where either the Assignee field is <USER> OR the Reviewer field is <USER>?


FWIW I found the following Closed Github Issues:


No OR operators, in general. But you can create custom filters, so it is possible, but will need to remain specific.

I believe the metamagik filters I included are chainable, I’ll double check next chance I get. And if I get a moment, I’ll see if I can make a filter to solve your specific need. If I happen to not get to it soon enough for you, take a look at:

For examples.


I actually looked into this a bit more, I could write you a filter, that would be specific to your need, but it would pretty much only be useful for you and in your exact methodology. However, after digging further into the LexerBuilder than I have ever looked I discovered, there actually is an OR Criteria. I’m not 100% sure how to exploit this, or if I even could, but I have some thoughts, which would be the better way to approach it…so that everyone can benefit. I just need to get some time to think about it and experiment.

You can see the OR criteria in action by simply using a filter more than once, i.e. assignee:name1 assignee:name2, but changing the filter brings it out of the OR loop, which becomes an AND…so basically assignee:name1 assignee:name2 metakey:owner metaval:name is Assignee name1 OR Assignee name2 AND Metakey owner AND Metaval name.

Pretty sure the best way to utilize the OrCriteria.php would be at the core, but not sure I would trust myself with that. As a filter/plugin, I could exploit it, by creating a filter that allows you to choose your search table, search column, and search value; but you would also need to specify the return and query in the task table…so it would get long and confusing…and to get what you want, it would look like, orfilter:users+name+searchname+id+owner_id orfilter:task_has_metadata+name+searchfield+task_id+id orfilter:task_has_metadata+value+searchvalue+task_id+id

And boy, does that look confusing…but since they would all be through the same filter, they would have the OR criteria…and it would find Assignees with the Name searchname OR Tasks with the Custom Field searchfield OR Tasks with the Custom Field Value searchvalue…which now that I think about it, is NOT what you want!!! see even I am confused…it would look like this then…

orfilter:users+name+searchname+id+owner_id metakey:searchfield orfilter:task_has_metadata+value+searchvalue+task_id+id

and now it would find Assignees with the Name searchname OR Tasks with the Custom Field Value searchvalue AND Tasks with the Custom Field searchfield.

This is all good in theory, but pretty sure the +'s would get stripped out…so, I’d have to figure out some serperators…

I’ll think about this some more…


I appreciate the amount of thought put into this. I don’t think it’s beneficial for either of us to work towards a workaround like this. I’m sure a well-implemented OR functionality can be elegantly introduced sooner or later.

FWIW, if Frederick Guillot could give us a brain dump of what he envisions it could look like, I’d be happier knowing that information is out there. Especially considering all that we have to go on right now is:

The OR operator is not yet supported.


It seems like it’s just:

  1. beginOr()
  2. Raw query 1
  3. Raw query 2
  4. closeOr()

(see for a reference)

It’s almost like any plugin would have to intercept and pre-process any query and split it up based on OR keywords. Of course, there should also be the additional option to parse parens in order to logically separate a self-contained OR statement.


i wasn’t referring to beginOr()…closeOr(), that works fine and you could utilize that for your own custom filter.

I was referring to:

which is being utilized in the LexerBuilder, here:

This is basically saying, if there are more than one value for a filter, use OR criterias, else, it’s an AND.