Skip to content

Commit

Permalink
search: added id in search and sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatimah committed Oct 18, 2023
1 parent c2f028a commit 2dbc96a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions invenio_users_resources/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@
"sort": [
"email",
"username",
"id",
"email_domain",
],
"facets": ["email_domain", "affiliations"],
}
"""User search configuration (i.e list of banners)."""

USERS_RESOURCES_SORT_OPTIONS = {
"id": dict(
title=_("ID"),
fields=["id"],
),
"username": dict(
title=_("Username"),
fields=["username"],
Expand Down
8 changes: 7 additions & 1 deletion invenio_users_resources/services/users/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ class UserSearchOptions(SearchOptions, SearchOptionsMixin):
}
query_parser_cls = QueryParser.factory(
tree_transformer_cls=SearchFieldTransformer,
fields=["username^2", "email^2", "profile.full_name^3", "profile.affiliations"],
fields=[
"username^2",
"email^2",
"id^3",
"profile.full_name^3",
"profile.affiliations",
],
allow_list=["username", "email"], # mapped fields are added on the query parser
mapping={
"affiliation": "profile.affiliations",
Expand Down

0 comments on commit 2dbc96a

Please sign in to comment.