Browse Source

Change the notation of "contains any of" filter operator to "*~" (#38435).


git-svn-id: https://svn.redmine.org/redmine/trunk@22197 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/5.1.0
Go MAEDA 1 year ago
parent
commit
0f6507a607

+ 5
- 5
app/models/issue_query.rb View File

@@ -614,8 +614,8 @@ class IssueQuery < Query
when "*", "!*"
e = (operator == "*" ? "EXISTS" : "NOT EXISTS")
"#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id)"
when "~", "!~", "|~"
c = sql_contains("a.filename", value.first, :all_words => (operator != "|~"))
when "~", "!~", "*~"
c = sql_contains("a.filename", value.first, :all_words => (operator != "*~"))
e = (operator == "!~" ? "NOT EXISTS" : "EXISTS")
"#{e} (SELECT 1 FROM #{Attachment.table_name} a WHERE a.container_type = 'Issue' AND a.container_id = #{Issue.table_name}.id AND (#{c}))"
when "^", "$"
@@ -630,9 +630,9 @@ class IssueQuery < Query
case operator
when '*', '!*'
(operator == '*' ? cond_description : "NOT (#{cond_description})")
when '~', '!~', '|~'
when '~', '!~', '*~'
(operator == '~' ? '' : "#{cond_description} AND ") +
sql_contains('a.description', value.first, :match => (operator != '!~'), :all_words => (operator != '|~'))
sql_contains('a.description', value.first, :match => (operator != '!~'), :all_words => (operator != '*~'))
when '^', '$'
sql_contains('a.description', value.first, (operator == '^' ? :starts_with : :ends_with) => true)
else
@@ -794,7 +794,7 @@ class IssueQuery < Query
is_all_words =
case operator
when '~' then true
when '|~', '!~' then false
when '*~', '!~' then false
end

fetcher = Redmine::Search::Fetcher.new(

+ 5
- 5
app/models/query.rb View File

@@ -306,7 +306,7 @@ class Query < ActiveRecord::Base
"t-" => :label_ago,
"~" => :label_contains,
"!~" => :label_not_contains,
"|~" => :label_contains_any_of,
"*~" => :label_contains_any_of,
"^" => :label_starts_with,
"$" => :label_ends_with,
"=p" => :label_any_issues_in_project,
@@ -324,9 +324,9 @@ class Query < ActiveRecord::Base
:list_subprojects => [ "*", "!*", "=", "!" ],
:date => [ "=", ">=", "<=", "><", "<t+", ">t+", "><t+", "t+", "nd", "t", "ld", "nw", "w", "lw", "l2w", "nm", "m", "lm", "y", ">t-", "<t-", "><t-", "t-", "!*", "*" ],
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "><t-", "t-", "t", "ld", "w", "lw", "l2w", "m", "lm", "y", "!*", "*" ],
:string => [ "~", "|~", "=", "!~", "!", "^", "$", "!*", "*" ],
:text => [ "~", "|~", "!~", "^", "$", "!*", "*" ],
:search => [ "~", "|~", "!~" ],
:string => [ "~", "*~", "=", "!~", "!", "^", "$", "!*", "*" ],
:text => [ "~", "*~", "!~", "^", "$", "!*", "*" ],
:search => [ "~", "*~", "!~" ],
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],
:float => [ "=", ">=", "<=", "><", "!*", "*" ],
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"],
@@ -1432,7 +1432,7 @@ class Query < ActiveRecord::Base
sql = sql_contains("#{db_table}.#{db_field}", value.first)
when "!~"
sql = sql_contains("#{db_table}.#{db_field}", value.first, :match => false)
when "|~"
when "*~"
sql = sql_contains("#{db_table}.#{db_field}", value.first, :all_words => false)
when "^"
sql = sql_contains("#{db_table}.#{db_field}", value.first, :starts_with => true)

+ 1
- 1
lib/redmine/wiki_formatting/textile/redcloth3.rb View File

@@ -348,7 +348,7 @@ class RedCloth3 < String
S = "(?:#{S_CSPN}?#{S_RSPN}|#{S_RSPN}?#{S_CSPN}?)"
C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)"
# PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' )
PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`*~' )
PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
PUNCT_Q = Regexp::quote( '*-_+^~%' )
HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'

+ 4
- 4
test/unit/query_test.rb View File

@@ -742,7 +742,7 @@ class QueryTest < ActiveSupport::TestCase
:name => '_',
:filters => {
'subject' => {
:operator => '|~',
:operator => '*~',
:values => ['close block']
}
}
@@ -758,7 +758,7 @@ class QueryTest < ActiveSupport::TestCase
:name => '_',
:filters => {
'any_searchable' => {
:operator => '|~',
:operator => '*~',
:values => ['recipe categories']
}
}
@@ -773,7 +773,7 @@ class QueryTest < ActiveSupport::TestCase
:name => '_',
:filters => {
'attachment' => {
:operator => '|~',
:operator => '*~',
:values => ['source changeset']
}
}
@@ -788,7 +788,7 @@ class QueryTest < ActiveSupport::TestCase
:name => '_',
:filters => {
'attachment_description' => {
:operator => '|~',
:operator => '*~',
:values => ['ruby issue']
}
}

Loading…
Cancel
Save