datatypes.search
#
- class tonita.datatypes.search.SearchRequest(query=None, listing_id=None, categories=None, facet_restrictions=None)#
Contains search request data.
This dataclass will typically only be used for submitting evaluations and feedback.
- Parameters:
query (Optional[str]) – See tonita.search parameter docstrings.
listing_id (Optional[str]) – See tonita.search parameter docstrings.
categories (Optional[List[str]]) – See tonita.search parameter docstrings.
facet_restrictions (Optional[List[Dict[str, Any]]]) – See tonita.search parameter docstrings.
- class tonita.datatypes.search.Snippet(display_string)#
Explains why a listing was considered relevant to a query.
- Parameters:
display_string (str) – We simply return a single string that describes the basis for why a response item was returned. The caller may choose to use this, e.g. for displaying as a highlighted snippet under the title of the result.
- class tonita.datatypes.search.SearchResponseItem(listing_id, score, categories, snippets)#
A single search result.
- Parameters:
listing_id (str) – The ID of a listing considered relevant to the query.
score (float) – A higher score denotes a better match to the query.
categories (List[str]) – The set of categories this listing belongs to.
snippets (List[Snippet]) – Explains why this listing was considered a relevant match for the query.
- class tonita.datatypes.search.SearchResponse(items, search_response_id)#
Response to a search request.
- Parameters:
items (List[SearchResponseItem]) – A list of search results.
search_response_id (str) – An ID for this search response.