@Override protected Query getFuzzyQuery(String field, String term, float min) throws ParseException { return super.getFuzzyQuery(field, getCanonicalTerm(field, term), min); }
@Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { if (isPass2ResolvingPhrases) { checkPhraseClauseIsForSameField(field); } return super.getFuzzyQuery(field, termStr, minSimilarity); }
@Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { if (isPass2ResolvingPhrases) { checkPhraseClauseIsForSameField(field); } return super.getFuzzyQuery(field, termStr, minSimilarity); }
/** * Called when parser parses an input term that has the fuzzy suffix (~) appended. * <p> * Depending on analyzer and settings, a fuzzy term may (most probably will) * be lower-cased automatically. It <b>will</b> go through the default Analyzer. * <p> * Overrides super class, by passing terms through analyzer. * * @param field Name of the field query will use. * @param termStr Term to use for building term for the query * * @return Resulting {@link Query} built for the term */ @Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { String analyzed = analyzeSingleChunk(field, termStr, termStr); return super.getFuzzyQuery(field, analyzed, minSimilarity); }
/** * Called when parser parses an input term that has the fuzzy suffix (~) appended. * <p> * Depending on analyzer and settings, a fuzzy term may (most probably will) * be lower-cased automatically. It <b>will</b> go through the default Analyzer. * <p> * Overrides super class, by passing terms through analyzer. * * @param field Name of the field query will use. * @param termStr Term to use for building term for the query * * @return Resulting {@link Query} built for the term */ @Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { String analyzed = analyzeSingleChunk(field, termStr, termStr); return super.getFuzzyQuery(field, analyzed, minSimilarity); }
@Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { if (field == null) { List<BooleanClause> clauses = new ArrayList<>(); for (int i = 0; i < fields.length; i++) { clauses.add(new BooleanClause(getFuzzyQuery(fields[i], termStr, minSimilarity), BooleanClause.Occur.SHOULD)); } return getBooleanQuery(clauses, true); } return super.getFuzzyQuery(field, termStr, minSimilarity); }
@Override protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { if (field == null) { List<BooleanClause> clauses = new ArrayList<>(); for (int i = 0; i < fields.length; i++) { clauses.add(new BooleanClause(getFuzzyQuery(fields[i], termStr, minSimilarity), BooleanClause.Occur.SHOULD)); } return getBooleanQuery(clauses, true); } return super.getFuzzyQuery(field, termStr, minSimilarity); }
private Query getFuzzyQuerySingle(String field, String termStr, String minSimilarity) throws ParseException { currentFieldType = parseContext.fieldMapper(field); if (currentFieldType != null) { try { return currentFieldType.fuzzyQuery(termStr, Fuzziness.build(minSimilarity), fuzzyPrefixLength, settings.fuzzyMaxExpansions(), FuzzyQuery.defaultTranspositions); } catch (RuntimeException e) { if (settings.lenient()) { return null; } throw e; } } return super.getFuzzyQuery(field, termStr, Float.parseFloat(minSimilarity)); }