Skip to navigation
Qparser.PrefixPlugin
28.11.21
qparser module Parser object class whoosh.qparser.QueryParser(fieldname, schema, plugins=None, termclass=
, phraseclass=
, group=
) A hand-written query parser built on modular plug-ins. The default configuration implements a powerful fielded query language similar to Lucene’s. You can use the plugins argument when creating the object to override the default list of plug-ins, and/or use add_plugin() and/or remove_plugin_class() to change the plug-ins included in the parser. >>> from whoosh import qparser >>> parser = qparser.QueryParser("content", schema) >>> parser.remove_plugin_class(qparser.WildcardPlugin) >>> parser.add_plugin(qparser.PrefixPlugin()) >>> parser.parse(u"hello there") And([Term("content", u"hello"), Term("content", u"there")]) Parameters: fieldname – the default field – the parser uses this as the field for any terms without an explicit field. schema – a whoosh.fields.Schema object to use when parsing. The appropriate fields in the schema will be used to tokenize terms/phrases before they are turned into query objects. You can specify None for the schema to create a parser that does not analyze the text of the query, usually for testing purposes. plugins – a list of plugins to use. WhitespacePlugin is automatically included, do not put it in this list. This overrides the default list of plugins. Classes in the list will be automatically instantiated. termclass – the query class to use for individual search terms. The default is whoosh.query.Term. phraseclass – the query class to use for phrases. The default is whoosh.query.Phrase. group – the default grouping. AndGroup makes terms required by default. OrGroup makes terms optional by default.
https://docs.red-dove.com/whoosh/api/qparser.html
Reply
Anonymous
Information Epoch 1732526777
Think hierarchically.
Home
Notebook
Contact us