Support exact match on file parts in file: operator
Keep the old "file" field around (using that name in the index for backwards compatibility), but call it PATH in the code to reflect the fact that it matches the full path. Add a new "filepart" repeated field that splits the filename on '/' and adds each unique component as a field value. Use "path:" to search only the path, and "file:" to search either the file or the full path. There is only support for single path components or the full path, not arbitrary sequences of subcomponents. The latter is possible but would result in combinatorial blowup of terms. If users really want to search on that, they can use multiple "file:" terms (discarding ordering) or use regex search. Regex search is still over the entire path, but this is implemented at the ChangeQueryBuilder level and may be changed in the future. Change-Id: I4f6e06bc3c07989f96e4e74e64113f521c05b9e3
This commit is contained in:
committed by
Shawn Pearce
parent
a76877cfb0
commit
64e0b0762f
@@ -182,8 +182,8 @@ comment:'TEXT'::
|
||||
+
|
||||
Changes that match 'TEXT' string in any comment left by a reviewer.
|
||||
|
||||
[[file]]
|
||||
file:'PATH', f:'PATH'::
|
||||
[[path]]
|
||||
path:'PATH'::
|
||||
+
|
||||
Matches any change touching file at 'PATH'. By default exact path
|
||||
matching is used, but regular expressions can be enabled by starting
|
||||
@@ -202,6 +202,18 @@ ones using a bracket expression). For example, to match all XML
|
||||
files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
|
||||
`file:"^name[1-3].xml"`.
|
||||
|
||||
[[file]]
|
||||
file:'NAME', f:'NAME'::
|
||||
+
|
||||
Matches any change touching a file containing the path component
|
||||
'NAME'. For example a `file:src` will match changes that modify
|
||||
files named `gerrit-server/src/main/java/Foo.java`. Name matching
|
||||
is exact match, `file:Foo.java` finds any change touching a file
|
||||
named exactly `Foo.java` and does not match `AbstractFoo.java`.
|
||||
+
|
||||
Regular expression matching can be enabled by starting the string
|
||||
with `^`. In this mode `file:` is an alias of `path:` (see above).
|
||||
|
||||
[[has]]
|
||||
has:draft::
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user