public static ToXContent fullParamer(WildcardQueryBuilder query, Paramer paramer) { if (paramer.boost != null) { query.boost(paramer.boost); } return query; }
/** * Implements the wildcard search query. Supported wildcards are {@code *}, which * matches any character sequence (including the empty one), and {@code ?}, * which matches any single character. Note this query can be slow, as it * needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, * a Wildcard term should not start with one of the wildcards {@code *} or * {@code ?}. * * @param name The field name * @param query The wildcard query string */ public static WildcardQueryBuilder wildcardQuery(String name, String query) { return new WildcardQueryBuilder(name, query); }
currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, currentFieldName); fieldName = currentFieldName; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = parser.currentName(); value = parser.text(); return new WildcardQueryBuilder(fieldName, value) .rewrite(rewrite) .boost(boost) .queryName(queryName);
private void setExtraMatchQueryParam(WildcardQueryBuilder wildcardQuery, Map<String, String> extraParamMap) { if (MapUtils.isEmpty(extraParamMap)) { return; } if (extraParamMap.containsKey("boost")) { String val = extraParamMap.get("boost"); wildcardQuery.boost(Float.valueOf(val)); } if (extraParamMap.containsKey("rewrite")) { String val = extraParamMap.get("rewrite"); wildcardQuery.rewrite(val); } } }
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(NAME); builder.startObject(fieldName); builder.field(WILDCARD_FIELD.getPreferredName(), value); if (rewrite != null) { builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); builder.endObject(); builder.endObject(); }
throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, currentFieldName); fieldName = currentFieldName; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = parser.currentName(); value = parser.text(); return Optional.of(new WildcardQueryBuilder(fieldName, value) .rewrite(rewrite) .boost(boost) .queryName(queryName));
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(NAME); builder.startObject(fieldName); builder.field(WILDCARD_FIELD.getPreferredName(), value); if (rewrite != null) { builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); builder.endObject(); builder.endObject(); }
currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, currentFieldName); fieldName = currentFieldName; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = parser.currentName(); value = parser.text(); return new WildcardQueryBuilder(fieldName, value) .rewrite(rewrite) .boost(boost) .queryName(queryName);
/** * Implements the wildcard search query. Supported wildcards are {@code *}, which * matches any character sequence (including the empty one), and {@code ?}, * which matches any single character. Note this query can be slow, as it * needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, * a Wildcard term should not start with one of the wildcards {@code *} or * {@code ?}. * * @param name The field name * @param query The wildcard query string */ public static WildcardQueryBuilder wildcardQuery(String name, String query) { return new WildcardQueryBuilder(name, query); }
public static ToXContent fullParamer(WildcardQueryBuilder query, Paramer paramer) { if (paramer.boost != null) { query.boost(paramer.boost); } return query; }
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(NAME); builder.startObject(fieldName); builder.field(WILDCARD_FIELD.getPreferredName(), value); if (rewrite != null) { builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); builder.endObject(); builder.endObject(); }
currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, currentFieldName); fieldName = currentFieldName; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = parser.currentName(); value = parser.text(); return new WildcardQueryBuilder(fieldName, value) .rewrite(rewrite) .boost(boost) .queryName(queryName);
/** * Implements the wildcard search query. Supported wildcards are <tt>*</tt>, which * matches any character sequence (including the empty one), and <tt>?</tt>, * which matches any single character. Note this query can be slow, as it * needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, * a Wildcard term should not start with one of the wildcards <tt>*</tt> or * <tt>?</tt>. * * @param name The field name * @param query The wildcard query string */ public static WildcardQueryBuilder wildcardQuery(String name, String query) { return new WildcardQueryBuilder(name, query); }
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(NAME); builder.startObject(fieldName); builder.field(WILDCARD_FIELD.getPreferredName(), value); if (rewrite != null) { builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); builder.endObject(); builder.endObject(); }
/** * Implements the wildcard search query. Supported wildcards are <tt>*</tt>, which * matches any character sequence (including the empty one), and <tt>?</tt>, * which matches any single character. Note this query can be slow, as it * needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, * a Wildcard term should not start with one of the wildcards <tt>*</tt> or * <tt>?</tt>. * * @param name The field name * @param query The wildcard query string */ public static WildcardQueryBuilder wildcardQuery(String name, String query) { return new WildcardQueryBuilder(name, query); }
/** * Implements the wildcard search query. Supported wildcards are {@code *}, which * matches any character sequence (including the empty one), and {@code ?}, * which matches any single character. Note this query can be slow, as it * needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, * a Wildcard term should not start with one of the wildcards {@code *} or * {@code ?}. * * @param name The field name * @param query The wildcard query string */ public static WildcardQueryBuilder wildcardQuery(String name, String query) { return new WildcardQueryBuilder(name, query); }