Feature #38402 » or_search_for_any_searchable-text-filter.patch
| app/models/issue_query.rb | ||
|---|---|---|
|
projects = nil
|
||
|
end
|
||
|
is_all_words =
|
||
|
case operator
|
||
|
when '~' then true
|
||
|
when '|~', '!~' then false
|
||
|
end
|
||
|
fetcher = Redmine::Search::Fetcher.new(
|
||
|
question, User.current, ['issue'], projects, all_words: (operator != '!~'), attachments: '0'
|
||
|
question, User.current, ['issue'], projects, all_words: is_all_words, attachments: '0'
|
||
|
)
|
||
|
ids = fetcher.result_ids.map(&:last)
|
||
|
if ids.present?
|
||
| app/models/query.rb | ||
|---|---|---|
|
"t-" => :label_ago,
|
||
|
"~" => :label_contains,
|
||
|
"!~" => :label_not_contains,
|
||
|
"|~" => :label_contains_any_of,
|
||
|
"^" => :label_starts_with,
|
||
|
"$" => :label_ends_with,
|
||
|
"=p" => :label_any_issues_in_project,
|
||
| ... | ... | |
|
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "><t-", "t-", "t", "ld", "w", "lw", "l2w", "m", "lm", "y", "!*", "*" ],
|
||
|
:string => [ "~", "=", "!~", "!", "^", "$", "!*", "*" ],
|
||
|
:text => [ "~", "!~", "^", "$", "!*", "*" ],
|
||
|
:search => [ "~", "!~" ],
|
||
|
:search => [ "~", "|~", "!~" ],
|
||
|
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],
|
||
|
:float => [ "=", ">=", "<=", "><", "!*", "*" ],
|
||
|
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"],
|
||
| config/locales/en.yml | ||
|---|---|---|
|
label_more_than_ago: more than days ago
|
||
|
label_ago: days ago
|
||
|
label_contains: contains
|
||
|
label_contains_any_of: contains any of
|
||
|
label_not_contains: doesn't contain
|
||
|
label_starts_with: starts with
|
||
|
label_ends_with: ends with
|
||
| test/unit/query_test.rb | ||
|---|---|---|
|
assert_equal [2], result.map(&:id)
|
||
|
end
|
||
|
def test_filter_any_searchable_with_contains_any_operator
|
||
|
User.current = User.find(1)
|
||
|
query = IssueQuery.new(
|
||
|
:name => '_',
|
||
|
:filters => {
|
||
|
'any_searchable' => {
|
||
|
:operator => '|~',
|
||
|
:values => ['recipe categories']
|
||
|
}
|
||
|
}
|
||
|
)
|
||
|
result = find_issues_with_query(query)
|
||
|
assert_equal [1, 2, 3], result.map(&:id)
|
||
|
end
|
||
|
def test_filter_any_searchable_with_multiple_words_negative
|
||
|
User.current = User.find(1)
|
||