Java Code Examples for org.apache.lucene.search.MultiTermQuery#SCORING_BOOLEAN_REWRITE
The following examples show how to use
org.apache.lucene.search.MultiTermQuery#SCORING_BOOLEAN_REWRITE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryParsers.java From Elasticsearch with Apache License 2.0 | 5 votes |
public static MultiTermQuery.RewriteMethod parseRewriteMethod(ParseFieldMatcher matcher, @Nullable String rewriteMethod, @Nullable MultiTermQuery.RewriteMethod defaultRewriteMethod) { if (rewriteMethod == null) { return defaultRewriteMethod; } if (matcher.match(rewriteMethod, CONSTANT_SCORE)) { return MultiTermQuery.CONSTANT_SCORE_REWRITE; } if (matcher.match(rewriteMethod, SCORING_BOOLEAN)) { return MultiTermQuery.SCORING_BOOLEAN_REWRITE; } if (matcher.match(rewriteMethod, CONSTANT_SCORE_BOOLEAN)) { return MultiTermQuery.CONSTANT_SCORE_BOOLEAN_REWRITE; } int firstDigit = -1; for (int i = 0; i < rewriteMethod.length(); ++i) { if (Character.isDigit(rewriteMethod.charAt(i))) { firstDigit = i; break; } } if (firstDigit >= 0) { final int size = Integer.parseInt(rewriteMethod.substring(firstDigit)); String rewriteMethodName = rewriteMethod.substring(0, firstDigit); if (matcher.match(rewriteMethodName, TOP_TERMS)) { return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); } if (matcher.match(rewriteMethodName, TOP_TERMS_BOOST)) { return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); } if (matcher.match(rewriteMethodName, TOP_TERMS_BLENDED_FREQS)) { return new MultiTermQuery.TopTermsBlendedFreqScoringRewrite(size); } } throw new IllegalArgumentException("Failed to parse rewrite_method [" + rewriteMethod + "]"); }
Example 2
Source File: QueryParsers.java From crate with Apache License 2.0 | 4 votes |
public static MultiTermQuery.RewriteMethod parseRewriteMethod(@Nullable String rewriteMethod, @Nullable MultiTermQuery.RewriteMethod defaultRewriteMethod, DeprecationHandler deprecationHandler) { if (rewriteMethod == null) { return defaultRewriteMethod; } if (CONSTANT_SCORE.match(rewriteMethod, deprecationHandler)) { return MultiTermQuery.CONSTANT_SCORE_REWRITE; } if (SCORING_BOOLEAN.match(rewriteMethod, deprecationHandler)) { return MultiTermQuery.SCORING_BOOLEAN_REWRITE; } if (CONSTANT_SCORE_BOOLEAN.match(rewriteMethod, deprecationHandler)) { return MultiTermQuery.CONSTANT_SCORE_BOOLEAN_REWRITE; } int firstDigit = -1; for (int i = 0; i < rewriteMethod.length(); ++i) { if (Character.isDigit(rewriteMethod.charAt(i))) { firstDigit = i; break; } } if (firstDigit >= 0) { final int size = Integer.parseInt(rewriteMethod.substring(firstDigit)); String rewriteMethodName = rewriteMethod.substring(0, firstDigit); if (TOP_TERMS.match(rewriteMethodName, deprecationHandler)) { return new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(size); } if (TOP_TERMS_BOOST.match(rewriteMethodName, deprecationHandler)) { return new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(size); } if (TOP_TERMS_BLENDED_FREQS.match(rewriteMethodName, deprecationHandler)) { return new MultiTermQuery.TopTermsBlendedFreqScoringRewrite(size); } } throw new IllegalArgumentException("Failed to parse rewrite_method [" + rewriteMethod + "]"); }