@Override public QueryBuilder translate(FuzzyQuery fuzzyQuery) { FuzzyQueryBuilder fuzzyQueryBuilder = QueryBuilders.fuzzyQuery(fuzzyQuery.getField(), fuzzyQuery.getValue()); if (fuzzyQuery.getFuzziness() != null) { fuzzyQueryBuilder.fuzziness(Fuzziness.build(fuzzyQuery.getFuzziness())); } if (fuzzyQuery.getMaxExpansions() != null) { fuzzyQueryBuilder.maxExpansions(fuzzyQuery.getMaxExpansions()); } if (fuzzyQuery.getPrefixLength() != null) { fuzzyQueryBuilder.prefixLength(fuzzyQuery.getPrefixLength()); } if (!fuzzyQuery.isDefaultBoost()) { fuzzyQueryBuilder.boost(fuzzyQuery.getBoost()); } return fuzzyQueryBuilder; }
/** Sets the fuzziness used when evaluated to a fuzzy query type. Defaults to "AUTO". */ public MatchQueryBuilder fuzziness(Object fuzziness) { this.fuzziness = Fuzziness.build(fuzziness); return this; }