Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
cd277619
Commit
cd277619
authored
Apr 18, 2013
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 828344: Make "contains all of the words" look for all words within the same comment or flag
r=LpSolit, a=LpSolit
parent
5151736b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
25 deletions
+113
-25
Search.pm
Bugzilla/Search.pm
+107
-21
Clause.pm
Bugzilla/Search/Clause.pm
+5
-1
Quicksearch.pm
Bugzilla/Search/Quicksearch.pm
+1
-3
No files found.
Bugzilla/Search.pm
View file @
cd277619
...
@@ -268,12 +268,14 @@ use constant OPERATOR_FIELD_OVERRIDE => {
...
@@ -268,12 +268,14 @@ use constant OPERATOR_FIELD_OVERRIDE => {
},
},
dependson
=>
MULTI_SELECT_OVERRIDE
,
dependson
=>
MULTI_SELECT_OVERRIDE
,
keywords
=>
MULTI_SELECT_OVERRIDE
,
keywords
=>
MULTI_SELECT_OVERRIDE
,
'flagtypes.name'
=>
MULTI_SELECT_OVERRIDE
,
'flagtypes.name'
=>
{
_non_changed
=>
\&
_flagtypes_nonchanged
,
},
longdesc
=>
{
longdesc
=>
{
%
{
MULTI_SELECT_OVERRIDE
()
},
changedby
=>
\&
_long_desc_changedby
,
changedby
=>
\&
_long_desc_changedby
,
changedbefore
=>
\&
_long_desc_changedbefore_after
,
changedbefore
=>
\&
_long_desc_changedbefore_after
,
changedafter
=>
\&
_long_desc_changedbefore_after
,
changedafter
=>
\&
_long_desc_changedbefore_after
,
_non_changed
=>
\&
_long_desc_nonchanged
,
},
},
'longdescs.count'
=>
{
'longdescs.count'
=>
{
changedby
=>
\&
_long_desc_changedby
,
changedby
=>
\&
_long_desc_changedby
,
...
@@ -769,6 +771,14 @@ sub _sql {
...
@@ -769,6 +771,14 @@ sub _sql {
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
(
$joins
,
$clause
)
=
$self
->
_charts_to_conditions
();
my
(
$joins
,
$clause
)
=
$self
->
_charts_to_conditions
();
if
(
!
$clause
->
as_string
&&
!
Bugzilla
->
params
->
{
'search_allow_no_criteria'
}
&&
!
$self
->
{
allow_unlimited
})
{
ThrowUserError
(
'buglist_parameters_required'
);
}
my
$select
=
join
(
', '
,
$self
->
_sql_select
);
my
$select
=
join
(
', '
,
$self
->
_sql_select
);
my
$from
=
$self
->
_sql_from
(
$joins
);
my
$from
=
$self
->
_sql_from
(
$joins
);
my
$where
=
$self
->
_sql_where
(
$clause
);
my
$where
=
$self
->
_sql_where
(
$clause
);
...
@@ -1308,14 +1318,7 @@ sub _sql_where {
...
@@ -1308,14 +1318,7 @@ sub _sql_where {
# SQL a bit more readable for debugging.
# SQL a bit more readable for debugging.
my
$where
=
join
(
"\n AND "
,
$self
->
_standard_where
);
my
$where
=
join
(
"\n AND "
,
$self
->
_standard_where
);
my
$clause_sql
=
$main_clause
->
as_string
;
my
$clause_sql
=
$main_clause
->
as_string
;
if
(
$clause_sql
)
{
$where
.=
"\n AND "
.
$clause_sql
if
$clause_sql
;
$where
.=
"\n AND "
.
$clause_sql
;
}
elsif
(
!
Bugzilla
->
params
->
{
'search_allow_no_criteria'
}
&&
!
$self
->
{
allow_unlimited
})
{
ThrowUserError
(
'buglist_parameters_required'
);
}
return
$where
;
return
$where
;
}
}
...
@@ -1994,16 +1997,6 @@ sub _quote_unless_numeric {
...
@@ -1994,16 +1997,6 @@ sub _quote_unless_numeric {
sub
build_subselect
{
sub
build_subselect
{
my
(
$outer
,
$inner
,
$table
,
$cond
,
$negate
)
=
@_
;
my
(
$outer
,
$inner
,
$table
,
$cond
,
$negate
)
=
@_
;
if
(
$table
eq
'longdescs'
)
{
# There is no index on the longdescs.thetext column and so it takes
# a long time to scan the whole table unconditionally. For this table,
# we return the subselect and let the DB optimizer restrict the search
# to some given bug list only based on other search criteria available.
my
$not
=
$negate
?
"NOT"
:
""
;
return
"$outer $not IN (SELECT DISTINCT $inner FROM $table WHERE $cond)"
;
}
else
{
# Execute subselects immediately to avoid dependent subqueries, which are
# Execute subselects immediately to avoid dependent subqueries, which are
# large performance hits on MySql
# large performance hits on MySql
my
$q
=
"SELECT DISTINCT $inner FROM $table WHERE $cond"
;
my
$q
=
"SELECT DISTINCT $inner FROM $table WHERE $cond"
;
...
@@ -2011,7 +2004,6 @@ sub build_subselect {
...
@@ -2011,7 +2004,6 @@ sub build_subselect {
my
$list
=
$dbh
->
selectcol_arrayref
(
$q
);
my
$list
=
$dbh
->
selectcol_arrayref
(
$q
);
return
$negate
?
"1=1"
:
"1=2"
unless
@$list
;
return
$negate
?
"1=1"
:
"1=2"
unless
@$list
;
return
$dbh
->
sql_in
(
$outer
,
$list
,
$negate
);
return
$dbh
->
sql_in
(
$outer
,
$list
,
$negate
);
}
}
}
# Used by anyexact to get the list of input values. This allows us to
# Used by anyexact to get the list of input values. This allows us to
...
@@ -2432,6 +2424,43 @@ sub _long_desc_changedbefore_after {
...
@@ -2432,6 +2424,43 @@ sub _long_desc_changedbefore_after {
}
}
}
}
sub
_long_desc_nonchanged
{
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$operator
,
$value
,
$joins
,
$bugs_table
)
=
@$args
{
qw(chart_id operator value joins bugs_table)
};
my
$dbh
=
Bugzilla
->
dbh
;
my
$table
=
"longdescs_$chart_id"
;
my
$join_args
=
{
chart_id
=>
$chart_id
,
sequence
=>
$chart_id
,
field
=>
'longdesc'
,
full_field
=>
"$table.thetext"
,
operator
=>
$operator
,
value
=>
$value
,
all_values
=>
$value
,
quoted
=>
$dbh
->
quote
(
$value
),
joins
=>
[]
,
bugs_table
=>
$bugs_table
,
};
$self
->
_do_operator_function
(
$join_args
);
# If the user is not part of the insiders group, they cannot see
# private comments
if
(
!
$self
->
_user
->
is_insider
)
{
$join_args
->
{
term
}
.=
" AND $table.isprivate = 0"
;
}
my
$join
=
{
table
=>
'longdescs'
,
as
=>
$table
,
extra
=>
[
$join_args
->
{
term
}
],
};
push
(
@$joins
,
$join
);
$args
->
{
term
}
=
"$table.comment_id IS NOT NULL"
;
}
sub
_content_matches
{
sub
_content_matches
{
my
(
$self
,
$args
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$joins
,
$fields
,
$operator
,
$value
)
=
my
(
$chart_id
,
$joins
,
$fields
,
$operator
,
$value
)
=
...
@@ -2694,6 +2723,63 @@ sub _multiselect_multiple {
...
@@ -2694,6 +2723,63 @@ sub _multiselect_multiple {
}
}
}
}
sub
_flagtypes_nonchanged
{
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$operator
,
$value
,
$joins
,
$bugs_table
)
=
@$args
{
qw(chart_id operator value joins bugs_table)
};
my
$dbh
=
Bugzilla
->
dbh
;
my
$join
;
# join to the attachments table
my
$attach_table
=
"attachments_$chart_id"
;
$join
=
{
table
=>
'attachments'
,
as
=>
$attach_table
,
from
=>
"$bugs_table.bug_id"
,
to
=>
"bug_id"
,
extra
=>
[
(
$self
->
_user
->
is_insider
?
''
:
"$attach_table.isprivate = 0"
)
],
};
push
(
@$joins
,
$join
);
# join to the flags table
my
$flags_table
=
"flags_$chart_id"
;
$join
=
{
table
=>
'flags'
,
as
=>
$flags_table
,
from
=>
"$bugs_table.bug_id"
,
to
=>
"bug_id"
,
extra
=>
[
"($flags_table.attach_id = $attach_table.attach_id "
.
" OR $flags_table.attach_id IS NULL)"
],
};
push
(
@$joins
,
$join
);
# join to the flagtypes table
my
$flagtypes_table
=
"flagtypes_$chart_id"
;
$join
=
{
table
=>
'flagtypes'
,
as
=>
$flagtypes_table
,
from
=>
"$flags_table.type_id"
,
to
=>
"id"
,
};
push
(
@$joins
,
$join
);
# join to the profiles table for the requestee
my
$flag_profile_table
=
"flag_profiles_$chart_id"
;
$join
=
{
table
=>
'profiles'
,
as
=>
$flag_profile_table
,
from
=>
"$flags_table.requestee_id"
,
to
=>
"userid"
,
};
push
(
@$joins
,
$join
);
$args
->
{
full_field
}
=
$dbh
->
sql_string_concat
(
"$flagtypes_table.name"
,
"$flags_table.status"
,
"COALESCE($flag_profile_table.login_name, '')"
);
$self
->
_do_operator_function
(
$args
);
}
sub
_multiselect_nonchanged
{
sub
_multiselect_nonchanged
{
my
(
$self
,
$args
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$joins
,
$field
,
$operator
)
=
my
(
$chart_id
,
$joins
,
$field
,
$operator
)
=
...
...
Bugzilla/Search/Clause.pm
View file @
cd277619
...
@@ -86,6 +86,7 @@ sub walk_conditions {
...
@@ -86,6 +86,7 @@ sub walk_conditions {
sub
as_string
{
sub
as_string
{
my
(
$self
)
=
@_
;
my
(
$self
)
=
@_
;
if
(
!
$self
->
{
sql
})
{
my
@strings
;
my
@strings
;
foreach
my
$child
(
@
{
$self
->
children
})
{
foreach
my
$child
(
@
{
$self
->
children
})
{
next
if
$child
->
isa
(
__PACKAGE__
)
&&
!
$child
->
has_translated_conditions
;
next
if
$child
->
isa
(
__PACKAGE__
)
&&
!
$child
->
has_translated_conditions
;
...
@@ -93,6 +94,7 @@ sub as_string {
...
@@ -93,6 +94,7 @@ sub as_string {
&&
!
$child
->
translated
;
&&
!
$child
->
translated
;
my
$string
=
$child
->
as_string
;
my
$string
=
$child
->
as_string
;
next
unless
$string
;
if
(
$self
->
joiner
eq
'AND'
)
{
if
(
$self
->
joiner
eq
'AND'
)
{
$string
=
"( $string )"
if
$string
=~
/OR/
;
$string
=
"( $string )"
if
$string
=~
/OR/
;
}
}
...
@@ -104,7 +106,9 @@ sub as_string {
...
@@ -104,7 +106,9 @@ sub as_string {
my
$sql
=
join
(
' '
.
$self
->
joiner
.
' '
,
@strings
);
my
$sql
=
join
(
' '
.
$self
->
joiner
.
' '
,
@strings
);
$sql
=
"NOT( $sql )"
if
$sql
&&
$self
->
negate
;
$sql
=
"NOT( $sql )"
if
$sql
&&
$self
->
negate
;
return
$sql
;
$self
->
{
sql
}
=
$sql
;
}
return
$self
->
{
sql
};
}
}
# Search.pm converts URL parameters to Clause objects. This helps do the
# Search.pm converts URL parameters to Clause objects. This helps do the
...
...
Bugzilla/Search/Quicksearch.pm
View file @
cd277619
...
@@ -364,10 +364,8 @@ sub _handle_field_names {
...
@@ -364,10 +364,8 @@ sub _handle_field_names {
my
(
$or_operand
,
$negate
,
$unknownFields
,
$ambiguous_fields
)
=
@_
;
my
(
$or_operand
,
$negate
,
$unknownFields
,
$ambiguous_fields
)
=
@_
;
# Flag and requestee shortcut
# Flag and requestee shortcut
if
(
$or_operand
=~
/^(?:flag:)?([^\?]+\?
)(
[^\?]*)$/
)
{
if
(
$or_operand
=~
/^(?:flag:)?([^\?]+\?[^\?]*)$/
)
{
addChart
(
'flagtypes.name'
,
'substring'
,
$1
,
$negate
);
addChart
(
'flagtypes.name'
,
'substring'
,
$1
,
$negate
);
$chart
++
;
$and
=
$or
=
0
;
# Next chart for boolean AND
addChart
(
'requestees.login_name'
,
'substring'
,
$2
,
$negate
);
return
1
;
return
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment