@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setZeroTermsQuery(zeroTermsQuery); return matchQuery.parse(MatchQuery.Type.PHRASE, fieldName, value); }
sqp = new SimpleQueryStringQueryParser(resolvedFieldsAndWeights, flags, newSettings, context); } else { Analyzer luceneAnalyzer = context.getIndexAnalyzers().get(analyzer); if (luceneAnalyzer == null) { throw new QueryShardException(context, "[" + SimpleQueryStringBuilder.NAME + "] analyzer [" + analyzer
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setMaxExpansions(maxExpansions); return matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, fieldName, value); }
Analyzer analyzerObj = context.getIndexAnalyzers().get(analyzer); if (analyzerObj == null) { analyzerObj = context.getMapperService().searchAnalyzer();
NamedAnalyzer namedAnalyzer = context.getIndexAnalyzers().get(analyzer); if (namedAnalyzer == null) { throw new QueryShardException(context, "[query_string] analyzer [" + analyzer + "] not found"); NamedAnalyzer forceQuoteAnalyzer = context.getIndexAnalyzers().get(quoteAnalyzer); if (forceQuoteAnalyzer == null) { throw new QueryShardException(context, "[query_string] quote_analyzer [" + quoteAnalyzer + "] not found");
MultiMatchQuery multiMatchQuery = new MultiMatchQuery(context); if (analyzer != null) { if (context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found");
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setOccur(operator.toBooleanClauseOccur()); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setFuzziness(fuzziness); matchQuery.setFuzzyPrefixLength(prefixLength); matchQuery.setMaxExpansions(maxExpansions); matchQuery.setTranspositions(fuzzyTranspositions); matchQuery.setFuzzyRewriteMethod(QueryParsers.parseRewriteMethod(fuzzyRewrite, null, LoggingDeprecationHandler.INSTANCE)); matchQuery.setLenient(lenient); matchQuery.setCommonTermsCutoff(cutoffFrequency); matchQuery.setZeroTermsQuery(zeroTermsQuery); matchQuery.setAutoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery); Query query = matchQuery.parse(MatchQuery.Type.BOOLEAN, fieldName, value); return Queries.maybeApplyMinimumShouldMatch(query, minimumShouldMatch); }
@Override protected Analyzer getWrappedAnalyzer(String fieldName) { Analyzer analyzer = fieldNameAnalyzer.analyzers().get(fieldName); if (analyzer != null) { return analyzer; } else { return context.getIndexAnalyzers().getDefaultIndexAnalyzer(); } } };
@Override protected Analyzer getWrappedAnalyzer(String fieldName) { Analyzer analyzer = fieldNameAnalyzer.analyzers().get(fieldName); if (analyzer != null) { return analyzer; } else { return context.getIndexAnalyzers().getDefaultIndexAnalyzer(); } } };
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setAnalyzer(analyzer); matchQuery.setPhraseSlop(slop); return matchQuery.parse(MatchQuery.Type.PHRASE, fieldName, value); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setAnalyzer(analyzer); matchQuery.setPhraseSlop(slop); matchQuery.setMaxExpansions(maxExpansions); return matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, fieldName, value); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setZeroTermsQuery(zeroTermsQuery); return matchQuery.parse(MatchQuery.Type.PHRASE, fieldName, value); }
sqp = new SimpleQueryStringQueryParser(resolvedFieldsAndWeights, flags, newSettings, context); } else { Analyzer luceneAnalyzer = context.getIndexAnalyzers().get(analyzer); if (luceneAnalyzer == null) { throw new QueryShardException(context, "[" + SimpleQueryStringBuilder.NAME + "] analyzer [" + analyzer
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setZeroTermsQuery(zeroTermsQuery); return matchQuery.parse(MatchQuery.Type.PHRASE, fieldName, value); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setMaxExpansions(maxExpansions); return matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, fieldName, value); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setPhraseSlop(slop); matchQuery.setMaxExpansions(maxExpansions); return matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, fieldName, value); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } FuzzyAwareMatchQuery fuzzyAwareMatchQuery = new FuzzyAwareMatchQuery(context); fuzzyAwareMatchQuery.setOccur(operator.toBooleanClauseOccur()); fuzzyAwareMatchQuery.setAnalyzer(analyzer); fuzzyAwareMatchQuery.setFuzziness(fuzziness); fuzzyAwareMatchQuery.setFuzzyPrefixLength(prefixLength); fuzzyAwareMatchQuery.setMaxExpansions(maxExpansions); fuzzyAwareMatchQuery.setTranspositions(fuzzyTranspositions); fuzzyAwareMatchQuery.setFuzzyRewriteMethod(QueryParsers.parseRewriteMethod(fuzzyRewrite, null)); fuzzyAwareMatchQuery.setLenient(lenient); fuzzyAwareMatchQuery.setCommonTermsCutoff(cutoffFrequency); fuzzyAwareMatchQuery.setZeroTermsQuery(zeroTermsQuery); Query query = fuzzyAwareMatchQuery.parse(fieldName, value); return Queries.maybeApplyMinimumShouldMatch(query, minimumShouldMatch); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setOccur(operator.toBooleanClauseOccur()); matchQuery.setAnalyzer(analyzer); matchQuery.setPhraseSlop(slop); matchQuery.setFuzziness(fuzziness); matchQuery.setFuzzyPrefixLength(prefixLength); matchQuery.setMaxExpansions(maxExpansions); matchQuery.setTranspositions(fuzzyTranspositions); matchQuery.setFuzzyRewriteMethod(QueryParsers.parseRewriteMethod(fuzzyRewrite, null)); matchQuery.setLenient(lenient); matchQuery.setCommonTermsCutoff(cutoffFrequency); matchQuery.setZeroTermsQuery(zeroTermsQuery); Query query = matchQuery.parse(type, fieldName, value); return Queries.maybeApplyMinimumShouldMatch(query, minimumShouldMatch); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setOccur(operator.toBooleanClauseOccur()); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setFuzziness(fuzziness); matchQuery.setFuzzyPrefixLength(prefixLength); matchQuery.setMaxExpansions(maxExpansions); matchQuery.setTranspositions(fuzzyTranspositions); matchQuery.setFuzzyRewriteMethod(QueryParsers.parseRewriteMethod(fuzzyRewrite, null, LoggingDeprecationHandler.INSTANCE)); matchQuery.setLenient(lenient); matchQuery.setCommonTermsCutoff(cutoffFrequency); matchQuery.setZeroTermsQuery(zeroTermsQuery); matchQuery.setAutoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery); Query query = matchQuery.parse(MatchQuery.Type.BOOLEAN, fieldName, value); return Queries.maybeApplyMinimumShouldMatch(query, minimumShouldMatch); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { // validate context specific fields if (analyzer != null && context.getIndexAnalyzers().get(analyzer) == null) { throw new QueryShardException(context, "[" + NAME + "] analyzer [" + analyzer + "] not found"); } MatchQuery matchQuery = new MatchQuery(context); matchQuery.setOccur(operator.toBooleanClauseOccur()); if (analyzer != null) { matchQuery.setAnalyzer(analyzer); } matchQuery.setFuzziness(fuzziness); matchQuery.setFuzzyPrefixLength(prefixLength); matchQuery.setMaxExpansions(maxExpansions); matchQuery.setTranspositions(fuzzyTranspositions); matchQuery.setFuzzyRewriteMethod(QueryParsers.parseRewriteMethod(fuzzyRewrite, null, LoggingDeprecationHandler.INSTANCE)); matchQuery.setLenient(lenient); matchQuery.setCommonTermsCutoff(cutoffFrequency); matchQuery.setZeroTermsQuery(zeroTermsQuery); matchQuery.setAutoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery); Query query = matchQuery.parse(MatchQuery.Type.BOOLEAN, fieldName, value); return Queries.maybeApplyMinimumShouldMatch(query, minimumShouldMatch); }