azure.search.documents.models package¶
-
class
azure.search.documents.models.
AnswerResult
(*, additional_properties: Optional[Dict[str, Any]] = None, **kwargs)[source]¶ An answer is a text passage extracted from the contents of the most relevant documents that matched the query. Answers are extracted from the top search results. Answer candidates are scored and the top answers are selected.
Variables are only populated by the server, and will be ignored when sending a request.
- Parameters
additional_properties (dict[str, any]) – Unmatched properties from the message are deserialized to this collection.
- Variables
score (float) – The score value represents how relevant the answer is to the the query relative to other answers returned for the query.
key (str) – The key of the document the answer was extracted from.
text (str) – The text passage extracted from the document contents as the answer.
highlights (str) – Same text passage as in the Text property with highlighted text phrases most relevant to the query.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.search.documents.models.
Answers
(value)[source]¶ This parameter is only valid if the query type is ‘semantic’. If set, the query returns answers extracted from key passages in the highest ranked documents. The number of answers returned can be configured by appending the pipe character ‘|’ followed by the ‘count-
<number of answers>
’ option after the answers parameter value, such as ‘extractive|count-3’. Default count is 1.-
EXTRACTIVE
= 'extractive'¶ Extracts answer candidates from the contents of the documents returned in response to a query expressed as a question in natural language.
-
NONE
= 'none'¶ Do not return answers for the query.
-
-
class
azure.search.documents.models.
AutocompleteMode
(value)[source]¶ Specifies the mode for Autocomplete. The default is ‘oneTerm’. Use ‘twoTerms’ to get shingles and ‘oneTermWithContext’ to use the current context in producing autocomplete terms.
-
ONE_TERM
= 'oneTerm'¶ Only one term is suggested. If the query has two terms, only the last term is completed. For example, if the input is ‘washington medic’, the suggested terms could include ‘medicaid’, ‘medicare’, and ‘medicine’.
-
ONE_TERM_WITH_CONTEXT
= 'oneTermWithContext'¶ Completes the last term in a query with two or more terms, where the last two terms are a phrase that exists in the index. For example, if the input is ‘washington medic’, the suggested terms could include ‘washington medicaid’ and ‘washington medical’.
-
TWO_TERMS
= 'twoTerms'¶ Matching two-term phrases in the index will be suggested. For example, if the input is ‘medic’, the suggested terms could include ‘medicare coverage’ and ‘medical assistant’.
-
-
class
azure.search.documents.models.
IndexAction
(*, additional_properties: Optional[Dict[str, Any]] = None, action_type: Optional[str] = None, **kwargs)[source]¶ Represents an index action that operates on a document.
- Parameters
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.search.documents.models.
IndexingResult
(**kwargs)[source]¶ Status of an indexing operation for a single document.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
- Variables
key (str) – Required. The key of a document that was in the indexing request.
error_message (str) – The error message explaining why the indexing operation failed for the document identified by the key; null if indexing succeeded.
succeeded (bool) – Required. A value indicating whether the indexing operation succeeded for the document identified by the key.
status_code (int) – Required. The status code of the indexing operation. Possible values include: 200 for a successful update or delete, 201 for successful document creation, 400 for a malformed input document, 404 for document not found, 409 for a version conflict, 422 when the index is temporarily unavailable, or 503 for when the service is too busy.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.search.documents.models.
QueryLanguage
(value)[source]¶ The language of the query.
-
EN_US
= 'en-us'¶ English.
-
NONE
= 'none'¶ Query language not specified.
-
-
class
azure.search.documents.models.
QueryType
(value)[source]¶ Specifies the syntax of the search query. The default is ‘simple’. Use ‘full’ if your query uses the Lucene query syntax and ‘semantic’ if query syntax is not needed.
-
FULL
= 'full'¶ Uses the full Lucene query syntax for searches. Search text is interpreted using the Lucene query language which allows field-specific and weighted searches, as well as other advanced features.
-
SEMANTIC
= 'semantic'¶ Best suited for queries expressed in natural language as opposed to keywords. Improves precision of search results by re-ranking the top search results using a ranking model trained on the Web corpus.
-
SIMPLE
= 'simple'¶ Uses the simple query syntax for searches. Search text is interpreted using a simple query language that allows for symbols such as +, * and “”. Queries are evaluated across all searchable fields by default, unless the searchFields parameter is specified.
-
-
class
azure.search.documents.models.
SearchMode
(value)[source]¶ Specifies whether any or all of the search terms must be matched in order to count the document as a match.
-
ALL
= 'all'¶ All of the search terms must be matched in order to count the document as a match.
-
ANY
= 'any'¶ Any of the search terms must be matched in order to count the document as a match.
-
-
class
azure.search.documents.models.
Speller
(value)[source]¶ Improve search recall by spell-correcting individual search query terms.
-
LEXICON
= 'lexicon'¶ Speller corrects individual query terms using a static lexicon for the language specified by the queryLanguage parameter.
-
NONE
= 'none'¶ Speller not enabled.
-
-
azure.search.documents.models.
odata
(statement, **kwargs)[source]¶ Escape an OData query string.
The statement to prepare should include fields to substitute given inside braces, e.g. {somevar} and then pass the corresponding value as a keyword argument, e.g. somevar=10.
Example:
>>> odata("name eq {name} and age eq {age}", name="O'Neil", age=37) "name eq 'O''Neil' and age eq 37"