sparkly.query_generator package¶
Submodules¶
sparkly.query_generator.lucene_query_generator module¶
- class sparkly.query_generator.lucene_query_generator.LuceneQueryGenerator(analyzer, config: IndexConfig, index_reader)¶
Bases:
objectA class for generating queries for Lucene based indexes
- generate_query(doc: dict | Series, query_spec: QuerySpec)¶
Generate a query for doc given the query spec
- Parameters:
doc (dict | pd.Series) – a record that will be used to generate the query
query_spec (QuerySpec) – the template for the query being built
- Return type:
A lucene query which can be passed to an index searcher
- generate_query_clauses(doc: dict | Series, query_spec: QuerySpec)¶
generate the clauses for each field -> analyzer pair, filters are ignored
- Parameters:
doc (dict | pd.Series) – a record that will be used to generate the clauses
query_spec (QuerySpec) – the template for the query being built
- Return type:
A dict of ((field, indexed_fields) -> BooleanQuery)
sparkly.query_generator.query_spec module¶
- class sparkly.query_generator.query_spec.QuerySpec(*args, **kwargs)¶
Bases:
dictA specification for generating queries
- property boost_map¶
The boosting weights for each (search_field -> indexed_field) pair. If a pair doesn’t exist in the map, the boost weight is 1
- property filter¶
- is_subset(other) bool¶
- property size¶
- to_dict() dict¶
- union(other)¶