List of usage examples for org.apache.lucene.queryparser.flexible.standard CommonQueryParserConfiguration setMultiTermRewriteMethod
public void setMultiTermRewriteMethod(MultiTermQuery.RewriteMethod method);
From source file:org.exist.indexing.lucene.LuceneIndexWorker.java
License:Open Source License
protected void setOptions(Properties options, CommonQueryParserConfiguration parser) throws ParseException { if (options == null) return;/*from w w w. ja v a 2s .c o m*/ String option = options.getProperty(OPTION_DEFAULT_OPERATOR); if (option != null && parser instanceof QueryParserBase) { if (DEFAULT_OPERATOR_OR.equals(option)) ((QueryParserBase) parser).setDefaultOperator(QueryParser.OR_OPERATOR); else ((QueryParserBase) parser).setDefaultOperator(QueryParser.AND_OPERATOR); } option = options.getProperty(OPTION_LEADING_WILDCARD); if (option != null) parser.setAllowLeadingWildcard(option.equalsIgnoreCase("yes")); option = options.getProperty(OPTION_PHRASE_SLOP); if (option != null) { try { int slop = Integer.parseInt(option); parser.setPhraseSlop(slop); } catch (NumberFormatException e) { throw new ParseException("value for option " + OPTION_PHRASE_SLOP + " needs to be a number"); } } option = options.getProperty(OPTION_FILTER_REWRITE); if (option != null) { if (option.equalsIgnoreCase("yes")) parser.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE); else parser.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE); } }