Setting Query Options in Python OJAI
There are two categories of options you can set in your Python OJAI application. This topic describes both and shows you how to set each.
Setting Query Options Using a Python OJAI Method Call
Option Name | Description |
---|---|
ojai.mapr.query.include-query-plan |
Enables or disables availability of the query plan for retrieval Value: Default: |
ojai.mapr.query.result-as-document |
Enables or disables returning the query result as an OJAI
Value: Default: |
ojai.mapr.query.timeout-milliseconds |
Query timeout in milliseconds Maximum allowed value is 2147483647. Default: None; no timeout |
To set any of these query options, you must pass the option as the second parameter in the DocumentStore.find method.
The following code snippet sets the option to return the query result as a Document object:
options = {'ojai.mapr.query.result-as-document': True}
query_result = store.find(query, options=options)
Setting Query Options in Python Using OJAI Query Syntax
OJAI Query Options describes query options that are
available in all OJAI clients. To use these options in Python OJAI, you must construct your
query in JSON format and use the $options
keyword. See OJAI Query Syntax
for details about the syntax, including an example.