Types¶
Main types¶
- class app._types.AggregateSearchParameters(*, facets: list[str] | None = None, charts: list[DistributionChart | ScatterChart] | None = None, charts_y_axis: bool = False)[source]¶
- app._types.ChartsInfos[source]¶
Information about charts for a search result
alias of
dict[str,dict[str,Any]]
- class app._types.CommonParametersQuery[source]¶
Documentation and constraints for some common query parameters
- class app._types.DistributionChart(*, chart_type: Literal['DistributionChart'] = 'DistributionChart', field: str)[source]¶
Describes an entry for a distribution chart
- class app._types.ErrorSearchResponse(*, debug: SearchResponseDebug, errors: list[SearchResponseError])[source]¶
- class app._types.FacetInfo(*, name: str, items: list[FacetItem], count_error_margin: int | None = None)[source]¶
Search result for a facet
- class app._types.FacetItem(*, key: str, name: str, count: int | None, selected: bool)[source]¶
Describes an entry of a facet
- app._types.FacetsFilters[source]¶
Data about selected filters for each facet: facet name -> list of values
alias of
dict[str,list[str]]
- app._types.FacetsInfos[source]¶
Information about facets for a search result
alias of
dict[str,FacetInfo]
- class app._types.FetcherResult(*, status: FetcherStatus, document: dict[str, Any] | None)[source]¶
Result for a document fetcher
This is also used by pre-processors who have the opportunity to discard an entry
- class app._types.FetcherStatus(*values)[source]¶
Status of a fetcher
FOUND - document was found, index it
REMOVED - document was removed, remove it
SKIP - skip this document / update
RETRY - retry this document / update later
OTHER - unknown error
- class app._types.GetSearchParameters(*, facets: list[str] | None = None, charts: list[DistributionChart | ScatterChart] | None = None, charts_y_axis: bool = False, fields: list[str] | None = None, page_size: Annotated[int, Ge(ge=1)] = 10, page: Annotated[int, Ge(ge=1)] = 1, sort_by: str | None = None, q: str | None = None, boost_phrase: bool = False, langs: list[str] = ['en'], index_id: str | None = None, debug_info: list[DebugInfo] | None = None)[source]¶
GET parameters for search
- model_config = {'extra': 'forbid'}[source]¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod parse_charts_str(charts: str | list[str] | list[DistributionChart | ScatterChart] | None) list[DistributionChart | ScatterChart] | None[source]¶
Parse for get params are ‘field’ or ‘xfield:yfield’ separated by ‘,’ for Distribution and Scatter charts.
Directly the dictionnaries in POST request
- app._types.JSONType[source]¶
A precise expectation of what mappings looks like in json. (dict where keys are always of type str).
alias of
dict[str,Any]
- class app._types.PostSearchParameters(*, facets: list[str] | None = None, charts: list[DistributionChart | ScatterChart] | None = None, charts_y_axis: bool = False, fields: list[str] | None = None, page_size: Annotated[int, Ge(ge=1)] = 10, page: Annotated[int, Ge(ge=1)] = 1, sort_by: str | None = None, q: str | None = None, boost_phrase: bool = False, langs: list[str] = ['en'], index_id: str | None = None, debug_info: list[DebugInfo] | None = None, sort_params: dict[str, Any] | None = None)[source]¶
POST parameters for search
- class app._types.QuerySearchParameters(*, q: str | None = None, boost_phrase: bool = False, langs: list[str] = ['en'], index_id: str | None = None)[source]¶
Parameters for search, this class concentrates on parameters that define the search query
- model_config = {}[source]¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app._types.ResultSearchParameters(*, fields: list[str] | None = None, page_size: Annotated[int, Ge(ge=1)] = 10, page: Annotated[int, Ge(ge=1)] = 1, sort_by: str | None = None)[source]¶
Parameters that influence results presentation: pagination and sorting
- class app._types.ScatterChart(*, chart_type: Literal['ScatterChart'] = 'ScatterChart', x: str, y: str)[source]¶
Describes an entry for a scatter plot
- class app._types.SearchParameters(*, facets: list[str] | None = None, charts: list[DistributionChart | ScatterChart] | None = None, charts_y_axis: bool = False, fields: list[str] | None = None, page_size: Annotated[int, Ge(ge=1)] = 10, page: Annotated[int, Ge(ge=1)] = 1, sort_by: str | None = None, q: str | None = None, boost_phrase: bool = False, langs: list[str] = ['en'], index_id: str | None = None, debug_info: list[DebugInfo] | None = None)[source]¶
Parameters for search, common to GET and POST
- class app._types.SearchResponseDebug(*, lucene_query: str | None = None, es_query: dict[str, Any] | None = None, aggregations: dict[str, Any] | None = None)[source]¶
- class app._types.SearchResponseError(*, title: str, description: str | None = None, status: int | None = None)[source]¶
- class app._types.SuccessSearchResponse(*, hits: list[dict[str, Any]], aggregations: dict[str, Any] | None = None, facets: dict[str, FacetInfo] | None = None, charts: dict[str, dict[str, Any]] | None = None, page: int, page_size: int, page_count: int, debug: SearchResponseDebug | None = None, took: int, timed_out: bool, count: int, is_count_exact: bool, warnings: list[SearchResponseError] | None = None)[source]¶
- pydantic model app._types.QueryAnalysis[source]¶
An object containing different information about the query.
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- class app._types.QueryAnalysis(*, text_query: str | None = None, luqum_tree: Item | None = None, es_query: Query | None = None, facets_filters: dict[str, list[str]] | None = None)[source]
An object containing different information about the query.
- es_query: Query | None[source]
The query as an elasticsearch_dsl object
- facets_filters: dict[str, list[str]] | None[source]
The filters corresponding to the facets: a facet name and a list of values
- luqum_tree: Item | None[source]
The luqum tree corresponding to the text query
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}[source]
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- text_query: str | None[source]
The initial text query
Validations¶
- app.validations.check_all_values_are_fields_agg(index_id: str | None, values: list[str] | None) list[str][source]¶
Check that all values are fields with aggregate: true property, that is, correspond to a field with aggregation. Used to check that charts are facets are valid.