Skip to content

Commit

Permalink
Merge pull request #2076 from projectcaluma/feat-search-answer-exact-…
Browse files Browse the repository at this point in the history
…lookup

feat(filters): add EXACT_WORD lookup type to SearchAnswer
  • Loading branch information
winged authored Sep 27, 2023
2 parents 3e9399b + 23c0e55 commit 70e875c
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 70e875c

Please sign in to comment.