API Docs¶
Search engine API.
-
class
invenio_search.api.
DefaultFilter
(query=None, query_parser=None)[source]¶ Shortcut for defining default filters with query parser.
Build filter property with query parser.
-
query
¶ Build lazy query if needed.
-
-
class
invenio_search.api.
RecordsSearch
(**kwargs)[source]¶ Example subclass to searching records using Elastic DSL.
Use Meta to set kwargs defaults.
-
class
Meta
[source]¶ Configuration for
Search
andFacetedSearch
classes.-
default_filter
= None¶ Default filter added to search body.
Example:
default_filter = DefaultFilter('_access.owner:"1"')
.
-
-
classmethod
RecordsSearch.
faceted_search
(query=None, filters=None, search=None)[source]¶ Return faceted search instance with defaults set.
Parameters: - query – Elastic DSL query object (
Q
). - filters – Dictionary with selected facet values.
- search – An instance of
Search
class. (default:cls()
).
- query – Elastic DSL query object (
-
class
Configuration¶
Invenio Search Engine config parameters.
Utilities¶
Utility functions for search engine.
-
invenio_search.utils.
schema_to_index
(schema, index_names=None)[source]¶ Get index/doc_type given a schema URL.
>>> from invenio_search.utils import schema_to_index >>> schema_to_index('records/record-v1.0.0.json') ('records-record-v1.0.0', 'record-v1.0.0') >>> schema_to_index('default-v1.0.0.json') ('default-v1.0.0', 'default-v1.0.0') >>> schema_to_index('default-v1.0.0.json', index_names=[]) (None, None) >>> schema_to_index('invalidextension') (None, None)
Parameters: - schema – The schema name
- index_names – A list of index name.
Returns: A tuple containing (index, doc_type).