Feature #38402 » or_search_for_any_searchable-text-filter.patch
app/models/issue_query.rb | ||
---|---|---|
791 | 791 |
projects = nil |
792 | 792 |
end |
793 | 793 | |
794 |
is_all_words = |
|
795 |
case operator |
|
796 |
when '~' then true |
|
797 |
when '|~', '!~' then false |
|
798 |
end |
|
799 | ||
794 | 800 |
fetcher = Redmine::Search::Fetcher.new( |
795 |
question, User.current, ['issue'], projects, all_words: (operator != '!~'), attachments: '0'
|
|
801 |
question, User.current, ['issue'], projects, all_words: is_all_words, attachments: '0'
|
|
796 | 802 |
) |
797 | 803 |
ids = fetcher.result_ids.map(&:last) |
798 | 804 |
if ids.present? |
app/models/query.rb | ||
---|---|---|
306 | 306 |
"t-" => :label_ago, |
307 | 307 |
"~" => :label_contains, |
308 | 308 |
"!~" => :label_not_contains, |
309 |
"|~" => :label_contains_any_of, |
|
309 | 310 |
"^" => :label_starts_with, |
310 | 311 |
"$" => :label_ends_with, |
311 | 312 |
"=p" => :label_any_issues_in_project, |
... | ... | |
325 | 326 |
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "><t-", "t-", "t", "ld", "w", "lw", "l2w", "m", "lm", "y", "!*", "*" ], |
326 | 327 |
:string => [ "~", "=", "!~", "!", "^", "$", "!*", "*" ], |
327 | 328 |
:text => [ "~", "!~", "^", "$", "!*", "*" ], |
328 |
:search => [ "~", "!~" ], |
|
329 |
:search => [ "~", "|~", "!~" ],
|
|
329 | 330 |
:integer => [ "=", ">=", "<=", "><", "!*", "*" ], |
330 | 331 |
:float => [ "=", ">=", "<=", "><", "!*", "*" ], |
331 | 332 |
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"], |
config/locales/en.yml | ||
---|---|---|
810 | 810 |
label_more_than_ago: more than days ago |
811 | 811 |
label_ago: days ago |
812 | 812 |
label_contains: contains |
813 |
label_contains_any_of: contains any of |
|
813 | 814 |
label_not_contains: doesn't contain |
814 | 815 |
label_starts_with: starts with |
815 | 816 |
label_ends_with: ends with |
test/unit/query_test.rb | ||
---|---|---|
874 | 874 |
assert_equal [2], result.map(&:id) |
875 | 875 |
end |
876 | 876 | |
877 |
def test_filter_any_searchable_with_contains_any_operator |
|
878 |
User.current = User.find(1) |
|
879 |
query = IssueQuery.new( |
|
880 |
:name => '_', |
|
881 |
:filters => { |
|
882 |
'any_searchable' => { |
|
883 |
:operator => '|~', |
|
884 |
:values => ['recipe categories'] |
|
885 |
} |
|
886 |
} |
|
887 |
) |
|
888 |
result = find_issues_with_query(query) |
|
889 |
assert_equal [1, 2, 3], result.map(&:id) |
|
890 |
end |
|
891 | ||
877 | 892 |
def test_filter_any_searchable_with_multiple_words_negative |
878 | 893 |
User.current = User.find(1) |
879 | 894 |