Package org.codelibs.fess.query
Class FuzzyQueryCommand
java.lang.Object
org.codelibs.fess.query.QueryCommand
org.codelibs.fess.query.FuzzyQueryCommand
Query command implementation for handling fuzzy search queries.
This class converts Lucene FuzzyQuery objects into OpenSearch fuzzy query builders,
supporting configurable fuzzy matching parameters like edit distance and expansions.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codelibs.fess.query.QueryCommand
QueryCommand.DefaultQueryBuilderFunction, QueryCommand.FieldQueryBuilder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.opensearch.index.query.QueryBuilderconvertFuzzyQuery(QueryContext context, org.apache.lucene.search.FuzzyQuery fuzzyQuery, float boost) Converts a Lucene FuzzyQuery into an OpenSearch fuzzy query builder.org.opensearch.index.query.QueryBuilderexecute(QueryContext context, org.apache.lucene.search.Query query, float boost) Executes the fuzzy query command to convert a Lucene FuzzyQuery into an OpenSearch QueryBuilder.protected StringGets the class name of the query this command handles.Methods inherited from class org.codelibs.fess.query.QueryCommand
buildDefaultQueryBuilder, buildMatchPhraseQuery, convertWithFieldCheck, createDefaultQueryBuilder, createFieldSortBuilder, getQueryFieldConfig, getQueryLanguages, getQueryProcessor, getSearchField, isSearchField, register
-
Constructor Details
-
FuzzyQueryCommand
public FuzzyQueryCommand()Default constructor.
-
-
Method Details
-
getQueryClassName
Description copied from class:QueryCommandGets the class name of the query this command handles.- Specified by:
getQueryClassNamein classQueryCommand- Returns:
- The query class name.
-
execute
public org.opensearch.index.query.QueryBuilder execute(QueryContext context, org.apache.lucene.search.Query query, float boost) Executes the fuzzy query command to convert a Lucene FuzzyQuery into an OpenSearch QueryBuilder.- Specified by:
executein classQueryCommand- Parameters:
context- the query context containing search configurationquery- the Lucene query to convert (must be a FuzzyQuery)boost- the boost factor to apply to the query- Returns:
- OpenSearch QueryBuilder for fuzzy matching
- Throws:
InvalidQueryException- if the query is not a FuzzyQuery
-
convertFuzzyQuery
protected org.opensearch.index.query.QueryBuilder convertFuzzyQuery(QueryContext context, org.apache.lucene.search.FuzzyQuery fuzzyQuery, float boost) Converts a Lucene FuzzyQuery into an OpenSearch fuzzy query builder. Applies fuzzy matching configuration including edit distance, expansions, and prefix length.- Parameters:
context- the query context containing field mappingsfuzzyQuery- the Lucene FuzzyQuery to convertboost- the boost factor to apply- Returns:
- OpenSearch QueryBuilder configured for fuzzy matching
-