Skip to content

Commit 8cb59af

Browse files
committed
feat(types): add missing search parameters to document types
- Add `validate_field_names` to `QueryParameters` - Add `enable_synonyms`, `filter_curated_hits`, `synonym_prefix` to `RankingAndSortingParameters` - Add `facet_strategy` with literal type options to `FacetingParameters` - Add `enable_typos_for_alpha_numerical_tokens` and `synonym_num_typos` to `TypoToleranceParameters`
1 parent 58df75e commit 8cb59af

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/typesense/types/document.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ class QueryParameters(typing.TypedDict):
347347
preset (str): Preset for search queries.
348348
vector_query (str): Vector query for search.
349349
voice_query (str): Voice query for search.
350+
stopwords (str, list[str]): A comma separated list of words to be dropped from the search query while searching.
351+
validate_field_names (bool): Controls whether Typesense should validate if the fields exist in the schema.
350352
"""
351353

352354
prefix: typing.NotRequired[typing.Union[str, bool, typing.List[bool]]]
@@ -357,6 +359,8 @@ class QueryParameters(typing.TypedDict):
357359
preset: typing.NotRequired[str]
358360
vector_query: typing.NotRequired[str]
359361
voice_query: typing.NotRequired[str]
362+
stopwords: typing.NotRequired[typing.Union[str, typing.List[str]]]
363+
validate_field_names: typing.NotRequired[bool]
360364

361365

362366
class FilterParameters(typing.TypedDict):
@@ -393,6 +397,9 @@ class RankingAndSortingParameters(typing.TypedDict):
393397
enable_overrides (bool): Enable overrides.
394398
override_tags (str, list[str]): Tags to override.
395399
max_candidates (int): Maximum number of candidates to return.
400+
enable_synonyms (bool): If you have some synonyms defined but want to disable all of them for a particular search query, set `enable_synonyms` to `false`.
401+
filter_curated_hits (bool): Whether the `filter_by` condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.
402+
synonym_prefix (bool): Allow synonym resolution on word prefixes in the query.
396403
"""
397404

398405
query_by_weights: typing.NotRequired[typing.Union[str, typing.List[int]]]
@@ -406,6 +413,9 @@ class RankingAndSortingParameters(typing.TypedDict):
406413
enable_overrides: typing.NotRequired[bool]
407414
override_tags: typing.NotRequired[typing.Union[str, typing.List[str]]]
408415
max_candidates: typing.NotRequired[int]
416+
enable_synonyms: typing.NotRequired[bool]
417+
filter_curated_hits: typing.NotRequired[bool]
418+
synonym_prefix: typing.NotRequired[bool]
409419

410420

411421
class PaginationParameters(typing.TypedDict):
@@ -437,6 +447,7 @@ class FacetingParameters(typing.TypedDict):
437447
facet_return_parent (str): Return parent of facet.
438448
facet_sample_percent (int): Sample percentage of facet values to return.
439449
facet_sample_threshold (int): Sample threshold of facet values to return.
450+
facet_strategy (str): Typesense supports two strategies for efficient faceting, and has some built-in heuristics to pick the right strategy for you.
440451
"""
441452

442453
facet_by: typing.NotRequired[typing.Union[str, typing.List[str]]]
@@ -446,6 +457,13 @@ class FacetingParameters(typing.TypedDict):
446457
facet_return_parent: typing.NotRequired[str]
447458
facet_sample_percent: typing.NotRequired[int]
448459
facet_sample_threshold: typing.NotRequired[int]
460+
facet_strategy: typing.NotRequired[
461+
typing.Union[
462+
typing.Literal["exhaustive"],
463+
typing.Literal["top_values"],
464+
typing.Literal["automatic"], # default
465+
]
466+
]
449467

450468

451469
class GroupingParameters(typing.TypedDict):
@@ -518,6 +536,10 @@ class TypoToleranceParameters(typing.TypedDict):
518536
- `left_to_right`: Drop tokens from left to right.
519537
- `both_sides:3`: Drop tokens from both sides with a threshold of 3.
520538
Afterwards, drops back to the default right to left.
539+
540+
enable_typos_for_numerical_tokens (bool): Set this parameter to `false` to disable typos on numerical query tokens.
541+
enable_typos_for_alpha_numerical_tokens (bool): Set this parameter to `false` to disable typos on alphanumerical query tokens.
542+
synonym_num_typos (int): Allow synonym resolution on typo-corrected words in the query.
521543
"""
522544

523545
num_typos: typing.NotRequired[int]
@@ -530,6 +552,8 @@ class TypoToleranceParameters(typing.TypedDict):
530552
typing.Literal["right_to_left", "left_to_right", "both_sides:3"]
531553
]
532554
enable_typos_for_numerical_tokens: typing.NotRequired[bool]
555+
enable_typos_for_alpha_numerical_tokens: typing.NotRequired[bool]
556+
synonym_num_typos: typing.NotRequired[int]
533557

534558

535559
class CachingParameters(typing.TypedDict):

0 commit comments

Comments
 (0)