Feature #4939

List of tasks filtered as OR and not AND

Added by Alain V. over 9 years ago. Updated 3 days ago.

Status:NewStart date:2010-02-26
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues filter
Target version:-
Resolution:

Description

Hello

Up to now in the list of task you can filter upon some values but the list of filters are
List of tasks that has
filter1=value1 AND filter2=value2 AND filter3=value3

I think it could be interesting to have the possibility of
List of tasks that has
filter1=value1 OR filter2=value2 OR filter3=value3

Do you think it is possible? thank you

Redmine using OR.zip (11.5 KB) Quan VN, 2013-09-19 11:45

_query.zip - Plugins version, better than the patch version above (3.56 KB) Quan VN, 2015-11-20 02:49

_query.0.0.3.rm34.zip (4.38 KB) Quan VN, 2017-10-27 04:20

_query.0.0.4.redmine4x.tar.gz - _query plugin supports Redmine 4.x (3.17 KB) Emanuel Reisinger, 2019-09-25 09:50

_query.0.0.5.redmine4x.tar.gz - _query plugin supports Redmine 4.x with match operators (3.75 KB) Emanuel Reisinger, 2019-09-26 18:56

issue4939_orfilter.patch Magnifier - patch for the or filters (9.64 KB) Emanuel Reisinger, 2019-10-07 17:51

issue4939_match_operators.patch Magnifier - Patch for match operators; patch file based on orfilter patch (6.21 KB) Emanuel Reisinger, 2019-10-07 17:51

README.txt Magnifier - howto or-filters an match operators behave (2.72 KB) Emanuel Reisinger, 2019-10-07 17:51


Related issues

Related to Redmine - Feature #10999: Ticket list filter: More flexible filter conditions New
Duplicated by Redmine - Feature #7641: Issue filter with OR semantic additional to current AND s... Closed 2011-02-17
Duplicated by Redmine - Feature #12970: Implement the "OR" operator in queries Closed
Duplicated by Redmine - Feature #6332: "OR" filter and not only "AND" filter Closed 2010-09-08
Duplicated by Redmine - Feature #10421: Filter with OR conditions Closed
Duplicated by Redmine - Feature #21532: Adding OR and XOR request to REST API and issue filters Closed
Duplicated by Redmine - Feature #23211: Issue filter menu should have different logical operators... Closed
Duplicated by Redmine - Feature #23216: Issues List, Enhanced Filtering - Allowing Multiple Queri... Closed

History

#1 Updated by Jean-Philippe Lang over 9 years ago

  • Category set to Issues

#2 Updated by Andrew Sherman over 9 years ago

+1. This would be useful for some filters I have tried to make as well.

#3 Updated by Jeremy Walker over 9 years ago

+1 I would love it if Redmine had this functionality. Perhaps the easiest/most powerful way to implement this would be to make a way for users to create filters out of combinations of other filters. In other words, if I could define filters A, B, and C, and then say something like "Give me all the issues that are in A OR B, but not in C", I could get any issue list I could ever want. And that would be awesome.

#4 Updated by Jeremy Walker over 9 years ago

Jeremy Walker wrote:

+1 I would love it if Redmine had this functionality. Perhaps the easiest/most powerful way to implement this would be to make a way for users to create filter sets out of combinations of other filter sets. In other words, if I could define filter sets A, B, and C, and then say something like "Give me all the issues that are in A OR B, but not in C", I could get any issue list I could ever want. And that would be awesome.

#5 Updated by Alain V. about 9 years ago

Any progress on this subject guys? ;o)

#6 Updated by Matthias Neubert over 8 years ago

+1
Thats nearly what I ment with #7641, but I'd like to combine AND and OR freely.

e.g. A AND B OR C AND D

should list all issues which fullfill both, A and B

plus the issue which fillfill both, C and D

Basically it should be read like disjunctive normal form

#7 Updated by Matthias Neubert over 8 years ago

also this could be interesting when one wants to list all issues
assigned to me, and also all which aren't assigned yet.

for this feature a filtercriteria must be usable more than one time

or other solution: the list of possible assignees contains a special element "Not assigned" at the top of the list, so one can select (by multiple selection) me and "Not assigned"

#8 Updated by Gurvan Le Dromaguet over 6 years ago

It looks like it is implemented in "Trac": http://trac.edgewall.org/query, see the "OR" at the bottom right of the filters box

#9 Updated by Francesco V over 6 years ago

Gurvan Le Dromaguet wrote:

It looks like it is implemented in "Trac": http://trac.edgewall.org/query, see the "OR" at the bottom right of the filters box

I like it

#10 Updated by Daniel Felix over 6 years ago

Yes this would be a good improvement. It won't be easy but a really cool addition to the current filter-system.

#11 Updated by Christian Baus over 6 years ago

+1

any workaround here? we need a filter like "is autor or observer"

#12 Updated by Dani Leni about 6 years ago

+1

Need Assignee or Watcher.

#14 Updated by Quan VN about 6 years ago

Here is my quick and dirty solution. I am not a RoR developer and this is my very first attempt so that I can use Redmine for my job.
I hope that someone can make this into a full plugin. If you have any idea or find problem, please let me know. I will see if I can do anything. Thanks

#15 Updated by Christian Baus about 6 years ago

Thanks for your patch! i look forward to implement that in our redmine!!

#16 Updated by Zbynek Drlik almost 6 years ago

+1

#17 Updated by Lu Su over 5 years ago

+1

#18 Updated by Antoine Pichon over 5 years ago

+1 (thanks for your excellent work)

#19 Updated by Toshi MARUYAMA over 5 years ago

#20 Updated by Toshi MARUYAMA over 5 years ago

#21 Updated by Toshi MARUYAMA over 5 years ago

#22 Updated by James H over 5 years ago

+1

#23 Updated by Sebastian Paluch almost 5 years ago

Matthias Neubert wrote:

+1
Thats nearly what I ment with #7641, but I'd like to combine AND and OR freely.

e.g. A AND B OR C AND D

should list all issues which fullfill both, A and B

plus the issue which fillfill both, C and D

Basically it should be read like disjunctive normal form

+1

so important feature and no progress for 5 years :(

#24 Updated by Jan Niggemann (redmine.org team member) almost 5 years ago

so important feature and no progress for 5 years :(

We only have 2 programmers working in their spare time, plus contributions from a few other volunteers.

If you send patches that apply cleanly against current trunk (together with tests) we'd happily test and apply those.

#25 Updated by Istvan Heckl about 4 years ago

+1

#26 Updated by Quan VN about 4 years ago

I have made this patch into a plugins here (with some improvement). It works with redmine 2.6.x and 3.1.1 or less. Please use the plugin instead of this patch

http://www.redmine.org/plugins/zquery

#27 Updated by Jānis Elmeris almost 4 years ago

+1

#28 Updated by Quan VN almost 4 years ago

#29 Updated by Toshi MARUYAMA almost 4 years ago

  • Duplicated by Feature #21532: Adding OR and XOR request to REST API and issue filters added

#30 Updated by Fred B over 3 years ago

What is the difference between zquery and _query?

Did someone tested one with Redmine 2.4?

#31 Updated by Quan VN over 3 years ago

Fred B wrote:

What is the difference between zquery and _query?

Did someone tested one with Redmine 2.4?

Dear Fred
1. They are the same but I renamed zquery to _query so it is loaded first. _query is now the "official" version :-) (I have replace zquery attachment with _query but the name is still in the link)
2. I think it should work with 2.3 upward since I developed it based on 2.3 version
Quan

#32 Updated by Toshi MARUYAMA over 3 years ago

  • Duplicated by Feature #23211: Issue filter menu should have different logical operators like "AND", "OR", ... added

#33 Updated by Toshi MARUYAMA over 3 years ago

  • Category changed from Issues to Issues filter

#34 Updated by Toshi MARUYAMA over 3 years ago

  • Duplicated by Feature #23216: Issues List, Enhanced Filtering - Allowing Multiple Queries & "OR"-type constraints added

#35 Updated by JW Fuchs over 3 years ago

+1

#36 Updated by Iwadara I over 2 years ago

+1

#37 Updated by Reto Stamm over 2 years ago

+1

#38 Updated by Yuuki NARA over 2 years ago

+1

#39 Updated by Santiago Torres about 2 years ago

+1

#40 Updated by Shaun Gilroy almost 2 years ago

So is there any chance that the _query plugin getting updated to function with Redmine 3.4? I tried to figure out how to update it, but it's not clear to me what needs to be changed to make it compatible.

It gives me the following error in 3.4 as is:

Showing /opt/redmine/app/views/queries/_filters.html.erb where line #4 raised:

undefined method `remote' for #<Hash:0x007fe319fa1de8>
Extracted source (around line #464):
462
463
464
465
466
467

    available_filters.each do |field, filter|
      options = {:type => filter[:type], :name => filter[:name]}
      options[:remote] = true if filter.remote

      if has_filter?(field) || !filter.remote
        options[:values] = filter.values

Trace of template inclusion: app/views/queries/_query_form.html.erb, app/views/issues/index.html.erb

Rails.root: /Users/noysh/projects/farview/farview-devlink-3.4-stable

Application Trace | Framework Trace | Full Trace
app/models/query.rb:464:in `block in available_filters_as_json'
app/models/query.rb:462:in `each'
app/models/query.rb:462:in `available_filters_as_json'
app/views/queries/_filters.html.erb:4:in `block in _app_views_queries__filters_html_erb__941875204378063440_70306769152520'
app/views/queries/_filters.html.erb:1:in `_app_views_queries__filters_html_erb__941875204378063440_70306769152520'
app/views/queries/_query_form.html.erb:10:in `_app_views_queries__query_form_html_erb___1924681068357817272_70306752298920'
app/views/issues/index.html.erb:11:in `block in _app_views_issues_index_html_erb___4300101081652184242_70306752230600'
app/views/issues/index.html.erb:10:in `_app_views_issues_index_html_erb___4300101081652184242_70306752230600'
app/controllers/issues_controller.rb:51:in `block (2 levels) in index'
app/controllers/issues_controller.rb:46:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Request

Parameters:

{"project_id"=>"project_name"}
Toggle session dump
Toggle env dump
Response

Headers:

None

#41 Updated by Quan VN almost 2 years ago

Shaun Gilroy wrote:

So is there any chance that the _query plugin getting updated to function with Redmine 3.4? I tried to figure out how to update it, but it's not clear to me what needs to be changed to make it compatible.

It gives me the following error in 3.4 as is:
[...]

Dear Shaun
I am sorry. This version of plugin is too old. I create a separate entry for this plugin and put the update here and it works with redmine 3.4
https://www.redmine.org/plugins/boolean_query
Unfortunately I cannot find way to delete this old attachment
Quan

#42 Updated by Quan VN almost 2 years ago

For redmine 3.4, please use the version at
https://www.redmine.org/plugins/boolean_query
Or use new version attached here _query.0.0.3.rm34.zip

#43 Updated by Shaun Gilroy almost 2 years ago

Quan VN wrote:

For redmine 3.4, please use the version at
https://www.redmine.org/plugins/boolean_query
Or use new version attached here _query.0.0.3.rm34.zip

Excellent! Thank you!

#44 Updated by Roman Yagodin almost 2 years ago

+1

It could be great to allow filters with multiple conditions by same field (e.g. status is "open" AND status is not feedback) also.

#45 Updated by name zero over 1 year ago

+1 :}

#46 Updated by name zero over 1 year ago

Would it be possible to select the same field twice, so I can query "Due in the next 14 days or due date none" ?
Seems like the field is greyed out once it is selected.

#47 Updated by mouson chen about 1 year ago

+1

#48 Updated by Jérôme BATAILLE 6 months ago

Hi, I have developed this feature in my company, I will try to bring it as a plugin.

#49 Updated by Andreas Michel 2 months ago

is there an plugin version for 4.0? On the plugin site itself it tells me an 404?

Both https://www.redmine.org/plugins/boolean_query
and https://www.redmine.org/plugins/_query deliver 404

#50 Updated by Tobias Schmidt 2 months ago

As far as I know there is no version for 4.0 available. But you could keep an eye on mbideau/redmine_zquery. There even is an issue for redmine 4.xx support.

Andreas Michel wrote:

is there an plugin version for 4.0?

#51 Updated by Emanuel Reisinger 23 days ago

Tobias Schmidt wrote:

As far as I know there is no version for 4.0 available. But you could keep an eye on mbideau/redmine_zquery. There even is an issue for redmine 4.xx support.

Andreas Michel wrote:

is there an plugin version for 4.0?

But mbideau/redmine_zquery is an older version and does not suppport Redmine 3.4 as _query version 0.0.3 posted in #42 by Quan VN.

#52 Updated by Emanuel Reisinger 23 days ago

We are using OR filter in our work heavily and I have to upgrade our Ubuntu server and Redmine periodically.
With the last Ubuntu upgrade to 18.04 LTS Ruby 2.5 and Rails 5.2 was introduced. This versions are supported by Redmine 4.x only and I don't want maintain old versions of Ruby and Rails on our system.
So I have upgrade to Redmine 4.x.

I'm not a Ruby and Ruby on Rails developer but these are my first steps and with help of article https://www.justinweiss.com/articles/rails-5-module-number-prepend-and-the-end-of-alias-method-chain/ I could modify the plugin to work with Redmine 4.x because alias_method_chain and other methods has been removed with Rails 5.
I don't know how to integrate the new Query.operators match and not match in the new plugin implementation because there is no initializer/method for that.
So I removed these new operators because they are not required for the OR filters and are subjects for a separate plugin or patch to Query.statement. The latter is to prefer.
The second reason why I removed the new operators is that it's not clear where they come from.

Further I've changed the names of the or filters for a better understandability and moved the text into translation files and added german translations.
  • Any follow (AND) -> AND any following
  • Any follow (OR) -> OR any following
  • All follow (OR) -> OR all following

You can easily change the names by updating plugins/_query/config/locals/en.yml or adding further translations if you desire.

So I offer a plugin update for Redmine 4, see _query.0.0.4.redmine4x.tar.gz. Tested on Ubuntu 18.04 with Redmine 4.0.4.

I don't think that the plugin works with Redmine 3.4 because of the modifications besides alias_method_chain. I havn't tested it with Redmine 3.4.

By the way the implementation is really a quick and dirty hack because it overwrites the Query.statement method. Any changes in the core Query.statement implementation won't be considered by this plugin unless an update is made.
I'll try to create a patch to Redmine core with functionality as this plugin provides, so that this plugin is not required any longer.

#53 Updated by giorgio rossi 23 days ago

Thanks for Your work.

Unfortunately the two methods match and not match introduce the logical operators inside the string fields. For example, if I want to search for a more then a string in a field in OR:

Description match string1 ~ string2 ~ string3 ~ string4

I obtain as result all issues that contain at least one of the four strings in field Description

#54 Updated by Emanuel Reisinger 22 days ago

giorgio rossi wrote:

Thanks for Your work.

Unfortunately the two methods match and not match introduce the logical operators inside the string fields. For example, if I want to search for a more then a string in a field in OR:

Description match string1 ~ string2 ~ string3 ~ string4

I obtain as result all issues that contain at least one of the four strings in field Description

I've read the readme and now understand what the operators match and not match do.
They have nothing to do with the or filters but are useful extensions for the queries. But I still don't know how to implement the new operators in the _query plugin. Sorry.

#55 Updated by Emanuel Reisinger 21 days ago

I've found a simple solution to get match operators implemented in _query plugin.
So container _query.0.0.5.redmine4x.tar.gz includes or filters and match operators that works with Redmine 4.x.

#56 Updated by Emanuel Reisinger 11 days ago

I've made patches to integrate the or filters and match operators into redmine core.
So the _query plugin is obsolete with this patches.

The provided patch files has to be applied in the correct order and are based on svn revision 18620. First, issue4339_orfilter.patch and then issue4939_match_operators.patch.

The usage of or-filter and match operators should be added to the Redmine wiki [[https://www.redmine.org/projects/redmine/wiki/RedmineIssueList]] because without an usage descriptions the full power of the match operators are unknown. Therefore I added the README.txt of _query plugin which describes it.

#57 Updated by giorgio rossi 3 days ago

Fantastic job!!
Thanks You

Also available in: Atom PDF