QueryBuilder
Creates queries from the Analyzer chain.
Example usage:
QueryBuilder builder = new QueryBuilder(analyzer);
Query a = builder.createBooleanQuery("body", "just a test");
Query b = builder.createPhraseQuery("body", "another test");
Query c = builder.createMinShouldMatchQuery("body", "another test", 0.5f);
*This can also be used as a subclass for query parsers to make it easier to interact with the analysis chain. Factory methods such as newTermQuery are provided so that the generated queries can be customized.
Properties
Link copied to clipboard
Set to true if phrase queries should be automatically generated for multi terms synonyms. Default: false.
Link copied to clipboard
Enable or disable graph TokenStream processing (enabled by default).
Link copied to clipboard
Set to true to enable position increments in result query.
Functions
Link copied to clipboard
fun createBooleanQuery(field: String, queryText: String, operator: BooleanClause.Occur = BooleanClause.Occur.SHOULD): Query?
Creates a boolean query from the query text.
Link copied to clipboard
Creates a minimum-should-match query from the query text.
Link copied to clipboard
Creates a phrase query from the query text.