Skip to content

Commit

Permalink
search: add query parser mappings and allowed terms list
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandromumo authored and kpsherva committed Apr 20, 2023
1 parent d86ce0b commit e25d31c
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions invenio_communities/members/services/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ class PublicSearchOptions(SearchOptions):
"user.profile.full_name^3",
"user.profile.affiliations",
],
tree_transformer_factory=SearchFieldTransformer.factory(
mapping={
"affiliation": "user.profile.affiliations",
"affiliations": "user.profile.affiliations",
"full_name": "user.profile.full_name",
"fullname": "user.profile.full_name",
"name": "user.profile.full_name",
"username": "user.username",
}
),
allow_list=[ # present to restrict to mapped fields
"user.profile.affiliations",
"user.profile.full_name",
"user.username",
],
mapping={
"affiliation": "user.profile.affiliations",
"affiliations": "user.profile.affiliations",
"full_name": "user.profile.full_name",
"fullname": "user.profile.full_name",
"name": "user.profile.full_name",
"username": "user.username",
},
tree_transformer_cls=SearchFieldTransformer,
)


Expand Down Expand Up @@ -136,17 +140,22 @@ class MemberSearchOptions(PublicSearchOptions):
"user.profile.full_name^3",
"user.profile.affiliations",
],
tree_transformer_factory=SearchFieldTransformer.factory(
mapping={
"affiliation": "user.profile.affiliations",
"affiliations": "user.profile.affiliations",
"email": "user.email",
"full_name": "user.profile.full_name",
"fullname": "user.profile.full_name",
"name": "user.profile.full_name",
"username": "user.username",
}
),
allow_list=[ # present to restrict to mapping
"user.profile.affiliations",
"user.profile.full_name",
"user.username",
"user.email",
],
mapping={
"affiliation": "user.profile.affiliations",
"affiliations": "user.profile.affiliations",
"email": "user.email",
"full_name": "user.profile.full_name",
"fullname": "user.profile.full_name",
"name": "user.profile.full_name",
"username": "user.username",
},
tree_transformer_cls=SearchFieldTransformer,
)


Expand Down

0 comments on commit e25d31c

Please sign in to comment.