nucliadb-models 6.5.0.post4404__py3-none-any.whl → 6.5.0.post4408__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nucliadb_models/search.py CHANGED
@@ -691,40 +691,86 @@ class Filter(BaseModel):
691
691
  return self
692
692
 
693
693
 
694
+ class CatalogQueryField(str, Enum):
695
+ Title = "title"
696
+ # Slug = "slug"
697
+
698
+
699
+ class CatalogQueryMatch(str, Enum):
700
+ Exact = "exact"
701
+ Words = "words"
702
+ Fuzzy = "fuzzy"
703
+ StartsWith = "starts_with"
704
+ EndsWith = "ends_with"
705
+ Contains = "contains"
706
+
707
+
708
+ class CatalogQuery(BaseModel):
709
+ field: CatalogQueryField = CatalogQueryField.Title
710
+ match: CatalogQueryMatch = CatalogQueryMatch.Exact
711
+ query: str = Field(min_length=1)
712
+
713
+ @model_validator(mode="after")
714
+ def check_match_field(self) -> Self:
715
+ if self.field != CatalogQueryField.Title:
716
+ if self.match not in [CatalogQueryMatch.Exact, CatalogQueryMatch.StartsWith]:
717
+ raise ValueError(
718
+ f"Match type `{self.match.value}` not supported for {self.field.value}. Use `exact` or `starts_with`."
719
+ )
720
+
721
+ return self
722
+
723
+
694
724
  class CatalogRequest(BaseModel):
695
- query: str = SearchParamDefaults.query.to_pydantic_field()
725
+ query: Union[str, CatalogQuery] = ParamDefault(
726
+ default="",
727
+ title="Query",
728
+ description="The query to search for",
729
+ ).to_pydantic_field()
696
730
  filter_expression: Optional[CatalogFilterExpression] = (
697
731
  SearchParamDefaults.catalog_filter_expression.to_pydantic_field()
698
732
  )
699
- filters: Union[list[str], list[Filter]] = Field(
700
- default=[],
701
- title="Filters",
702
- description="The list of filters to apply. Filtering examples can be found here: https://docs.nuclia.dev/docs/rag/advanced/search-filters", # noqa: E501
703
- )
704
733
  faceted: list[str] = SearchParamDefaults.faceted.to_pydantic_field()
705
734
  sort: Optional[SortOptions] = SearchParamDefaults.sort.to_pydantic_field()
706
735
  page_number: int = SearchParamDefaults.catalog_page_number.to_pydantic_field()
707
736
  page_size: int = SearchParamDefaults.catalog_page_size.to_pydantic_field()
737
+ hidden: Optional[bool] = SearchParamDefaults.hidden.to_pydantic_field()
738
+ show: list[ResourceProperties] = SearchParamDefaults.show.to_pydantic_field(
739
+ default=[ResourceProperties.BASIC, ResourceProperties.ERRORS]
740
+ )
741
+
708
742
  debug: SkipJsonSchema[bool] = SearchParamDefaults.debug.to_pydantic_field()
743
+
744
+ # Deprecated filter parameters
745
+ filters: Union[list[str], list[Filter]] = Field(
746
+ default=[],
747
+ title="Filters",
748
+ description="The list of filters to apply. Filtering examples can be found here: https://docs.nuclia.dev/docs/rag/advanced/search-filters", # noqa: E501
749
+ deprecated="Use filter_expression instead",
750
+ )
709
751
  with_status: Optional[ResourceProcessingStatus] = Field(
710
752
  default=None,
711
753
  title="With processing status",
712
754
  description="Filter results by resource processing status",
713
- deprecated="Use filters instead",
755
+ deprecated="Use filter_expression instead",
714
756
  )
715
757
  range_creation_start: Optional[DateTime] = (
716
- SearchParamDefaults.range_creation_start.to_pydantic_field()
758
+ SearchParamDefaults.range_creation_start.to_pydantic_field(
759
+ deprecated="Use filter_expression instead",
760
+ )
761
+ )
762
+ range_creation_end: Optional[DateTime] = SearchParamDefaults.range_creation_end.to_pydantic_field(
763
+ deprecated="Use filter_expression instead",
717
764
  )
718
- range_creation_end: Optional[DateTime] = SearchParamDefaults.range_creation_end.to_pydantic_field()
719
765
  range_modification_start: Optional[DateTime] = (
720
- SearchParamDefaults.range_modification_start.to_pydantic_field()
766
+ SearchParamDefaults.range_modification_start.to_pydantic_field(
767
+ deprecated="Use filter_expression instead",
768
+ )
721
769
  )
722
770
  range_modification_end: Optional[DateTime] = (
723
- SearchParamDefaults.range_modification_end.to_pydantic_field()
724
- )
725
- hidden: Optional[bool] = SearchParamDefaults.hidden.to_pydantic_field()
726
- show: list[ResourceProperties] = SearchParamDefaults.show.to_pydantic_field(
727
- default=[ResourceProperties.BASIC, ResourceProperties.ERRORS]
771
+ SearchParamDefaults.range_modification_end.to_pydantic_field(
772
+ deprecated="Use filter_expression instead",
773
+ )
728
774
  )
729
775
 
730
776
  @field_validator("faceted")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.5.0.post4404
3
+ Version: 6.5.0.post4408
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -16,7 +16,7 @@ nucliadb_models/notifications.py,sha256=3w1HeX9F8nuA7WupHdpXIksX7d0bHO9ofmemYp4R
16
16
  nucliadb_models/processing.py,sha256=nhKuHQjqCdb9zJVkYGPTLub23tK9e_lwL5OCDVymZjY,719
17
17
  nucliadb_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  nucliadb_models/resource.py,sha256=FkhwmbjoqQBGyKQIqa40WK2Vq3wtryZeIVWmJ4b-84g,9003
19
- nucliadb_models/search.py,sha256=Cg7W4Ng7G5UgMOAD-pkSz6fEcaiSTBdju6q8ApUNgag,85393
19
+ nucliadb_models/search.py,sha256=A-XM5zyv7QYL5MXhWRhOVIOJyaea2OSucDeWZchEtPo,86702
20
20
  nucliadb_models/security.py,sha256=opxaDLfvk3aU0sjesK0jGrYLx5h4YCwlKKN0moYs_ig,1150
21
21
  nucliadb_models/synonyms.py,sha256=afbaVqSQSxGLwi2PusVaLSRpkOtA5AZmWOKd1f4nl2E,690
22
22
  nucliadb_models/text.py,sha256=kY2ub7AaGm-4vNaLX3Ju2VvRw-eKZ2LRdM9z7XCNaG0,2898
@@ -32,7 +32,7 @@ nucliadb_models/graph/responses.py,sha256=Sdq8OgFAL1YT-1lJyLLrkqcScvj7YTEqAUwQ-k
32
32
  nucliadb_models/internal/__init__.py,sha256=zG33bUz1rHFPtvqQPWn4rDwBJt3FJodGuQYD45quiQg,583
33
33
  nucliadb_models/internal/predict.py,sha256=Pnx6MmLfK65eExe1XnVxqmSlvMwdowewwks9BOEoqMw,2029
34
34
  nucliadb_models/internal/shards.py,sha256=__y1OZtWGiNcPQEWfSFOj8yw458WGi7mM4vZe0K-L1Y,1691
35
- nucliadb_models-6.5.0.post4404.dist-info/METADATA,sha256=TNc6ywS-RXIapZG3UPtqRSoYuNQPT73lu77BzwcDeUU,776
36
- nucliadb_models-6.5.0.post4404.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- nucliadb_models-6.5.0.post4404.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.5.0.post4404.dist-info/RECORD,,
35
+ nucliadb_models-6.5.0.post4408.dist-info/METADATA,sha256=ZBOmc16uMUBowf7RzbtR17BwpCKtKfvJUvXQDaQv9JA,776
36
+ nucliadb_models-6.5.0.post4408.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ nucliadb_models-6.5.0.post4408.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.5.0.post4408.dist-info/RECORD,,