On Fri, 25 Oct 2024, Prashant Saxena wrote:
Here is the reference in the documentation:
https://lucene.apache.org/core/10_0_0/queryparser/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.html
Code:
sqparser = StandardQueryParser()
config = sqparser.getQueryConfigHandler()
#config.setAllowLeadingWildcard(False);
#config.setAnalyzer(analyzer)
It looks like the docs are wrong, these setters are on StandardQueryParser
itself. From the lucene source code in StandardQueryConfigHandler.java:
/**
* Key used to set whether leading wildcards are supported
*
* @see StandardQueryParser#setAllowLeadingWildcard(boolean)
* @see StandardQueryParser#getAllowLeadingWildcard()
*/
public static final ConfigurationKey<Boolean> ALLOW_LEADING_WILDCARD =
ConfigurationKey.newInstance();
/**
* Key used to set the {@link Analyzer} used for terms found in the query
*
* @see StandardQueryParser#setAnalyzer(Analyzer)
* @see StandardQueryParser#getAnalyzer()
*/
public static final ConfigurationKey<Analyzer> ANALYZER =
ConfigurationKey.newInstance();
>>> sqp = StandardQueryParser()
>>> sqp.setAllowLeadingWildcard(False)
The commented lines are not available, how do you use StandardQueryParse?
If you have Lucene usage questions, please ask on the Lucene users list,
[email protected].
Andi..