Support querying groups by name and name part

This adds two query operators for group queries:

1. name:
   Exact match on the group name (case-insensitive)
2. inname:
   Prefix match on a group name part (case-insensitive)

Change-Id: Iedec2574690881470ba7f0ff7cd12263e466352f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-01-03 16:15:01 +01:00
parent fadf363ef0
commit a45b072688
6 changed files with 82 additions and 7 deletions

View File

@@ -226,7 +226,7 @@ As result a list of link:#group-info[GroupInfo] entities is returned.
.Request
----
GET /groups/?query2=uuid:59b92f35489e62c80d1ab1bf0c2d17843038df8b HTTP/1.0
GET /groups/?query2=inname:test HTTP/1.0
----
.Response
@@ -238,13 +238,22 @@ As result a list of link:#group-info[GroupInfo] entities is returned.
)]}'
[
{
"url": "#/admin/groups/uuid-59b92f35489e62c80d1ab1bf0c2d17843038df8b",
"url": "#/admin/groups/uuid-68236a40ca78de8be630312d8ba50250bc5638ae",
"options": {},
"description": "Gerrit Site Administrators",
"group_id": 1,
"owner": "Administrators",
"description": "Group for running tests on MyProject",
"group_id": 20,
"owner": "MyProject-Test-Group",
"owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
"id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b"
"id": "68236a40ca78de8be630312d8ba50250bc5638ae"
},
{
"url": "#/admin/groups/uuid-99a534526313324a2667025c3f4e089199b736aa",
"options": {},
"description": "Testers for ProjectX",
"group_id": 17,
"owner": "ProjectX-Testers",
"owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
"id": "99a534526313324a2667025c3f4e089199b736aa"
}
]
----

View File

@@ -10,6 +10,17 @@ Operators act as restrictions on the search. As more operators
are added to the same query string, they further restrict the
returned results.
[[inname]]
inname:'NAMEPART'::
+
Matches groups that have a name part that starts with 'NAMEPART'
(case-insensitive).
[[name]]
name:'NAME'::
+
Matches groups that have the name 'NAME' (case-insensitive).
[[uuid]]
uuid:'UUID'::
+