Skip to content

Commit

Permalink
feat(filters): add EXACT_WORD lookup type to SearchAnswer
Browse files Browse the repository at this point in the history
  • Loading branch information
czosel committed Sep 27, 2023
1 parent 3e9399b commit 23c0e55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion caluma/caluma_form/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,17 @@ def convert_meta_value_field(field):


class SearchLookupMode(Enum):
"""
Lookup used in SearchAnswersFilterType.
Keep in mind that the SearchAnswer filter operates on a word-by-word basis.
This defines the lookup used for every single word.
"""

STARTSWITH = "startswith"
CONTAINS = "icontains"
TEXT = "search"
EXACT_WORD = "exact"


class SearchAnswersFilterType(InputObjectType):
Expand All @@ -289,7 +297,7 @@ class SearchAnswersFilterType(InputObjectType):
You may pass in a list of question slugs and/or a list of form slugs to define
which answers to search. If you pass in one or more forms, answers to the
questions in that form will be searched. If you pass in one or more question
slug, the corresponding answers are searched. If you pass both, a superset
slugs, the corresponding answers are searched. If you pass both, a superset
of both is searched (ie. they do not limit each other).
"""

Expand Down
9 changes: 8 additions & 1 deletion caluma/tests/__snapshots__/test_schema.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -2914,7 +2914,7 @@
You may pass in a list of question slugs and/or a list of form slugs to define
which answers to search. If you pass in one or more forms, answers to the
questions in that form will be searched. If you pass in one or more question
slug, the corresponding answers are searched. If you pass both, a superset
slugs, the corresponding answers are searched. If you pass both, a superset
of both is searched (ie. they do not limit each other).
"""
input SearchAnswersFilterType {
Expand All @@ -2924,10 +2924,17 @@
lookup: SearchLookupMode
}

"""
Lookup used in SearchAnswersFilterType.

Keep in mind that the SearchAnswer filter operates on a word-by-word basis.
This defines the lookup used for every single word.
"""
enum SearchLookupMode {
STARTSWITH
CONTAINS
TEXT
EXACT_WORD
}

type SelectedOption {
Expand Down

0 comments on commit 23c0e55

Please sign in to comment.