public static ToXContent fullParamer(MatchPhraseQueryBuilder query, Paramer paramer) { if (paramer.analysis != null) { query.analyzer(paramer.analysis); } if (paramer.boost != null) { query.boost(paramer.boost); } if (paramer.slop != null) { query.slop(paramer.slop); } return query; }
public static ToXContent fullParamer(MatchPhraseQueryBuilder query, Paramer paramer) { if (paramer.analysis != null) { query.analyzer(paramer.analysis); } if (paramer.boost != null) { query.boost(paramer.boost); } if (paramer.slop != null) { query.slop(paramer.slop); } return query; }
matchQuery.analyzer(analyzer); matchQuery.slop(slop); matchQuery.zeroTermsQuery(zeroTermsQuery);
/** * phrase query * use whitespace analyzer in the query * @param field * @param phrase already stemmed * @param slop * @return */ public SearchResponse matchPhrase(String field, String phrase, int slop){ SearchResponse response = client.prepareSearch(indexName).setSize(this.numDocs) .setTrackScores(false). setFetchSource(false).setExplain(false).setFetchSource(false). setQuery(QueryBuilders.matchPhraseQuery(field, phrase).slop(slop) .analyzer("whitespace")). execute().actionGet(); return response; // debug // XContentBuilder builder = XContentFactory.jsonBuilder(); // builder.startObject(); // System.out.println(response.toXContent(builder, ToXContent.EMPTY_PARAMS)); // builder.endObject(); // System.out.println(builder.string()); }
String analyzer = matchPhrase.analyzer().trim(); if (analyzer.length() > 0) { query.analyzer(analyzer);
.setFetchSource(false).setExplain(false).setFetchSource(false). setQuery(QueryBuilders.boolQuery().must(QueryBuilders.matchPhraseQuery(field, phrase) .slop(slop).analyzer("whitespace")).filter(idsFilterBuilder)) .execute().actionGet();
MatchPhraseQueryBuilder matchPhraseQuery = QueryBuilders.matchPhraseQuery(name, value); if (hint.analyzer != null) { matchPhraseQuery.analyzer(hint.analyzer);
matchQuery.analyzer(analyzer); matchQuery.slop(slop); matchQuery.zeroTermsQuery(zeroTermsQuery);
matchQuery.analyzer(analyzer); matchQuery.slop(slop); matchQuery.queryName(queryName);
matchQuery.analyzer(analyzer); matchQuery.slop(slop); matchQuery.zeroTermsQuery(zeroTermsQuery);