Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make diacritic_sensitive parameter optional to support $text operator on Cosmos DB #1089

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions beanie/odm/operators/find/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ def __init__(
search: str,
language: Optional[str] = None,
case_sensitive: bool = False,
diacritic_sensitive: bool = False,
diacritic_sensitive: Optional[bool] = False,
):
"""

:param search: str
:param language: Optional[str] = None
:param case_sensitive: bool = False
:param diacritic_sensitive: bool = False
:param diacritic_sensitive: Optional[bool] = False
"""
self.search = search
self.language = language
Expand All @@ -168,11 +168,14 @@ def query(self):
"$text": {
"$search": self.search,
"$caseSensitive": self.case_sensitive,
"$diacriticSensitive": self.diacritic_sensitive,
}
}
if self.language:
expression["$text"]["$language"] = self.language
if self.diacritic_sensitive is not None:
expression["$text"]["$diacriticSensitive"] = (
self.diacritic_sensitive
)
return expression


Expand Down
Loading