Class FuzzyQueryCommand

java.lang.Object
org.codelibs.fess.query.QueryCommand
org.codelibs.fess.query.FuzzyQueryCommand

public class FuzzyQueryCommand extends QueryCommand
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.
  • Constructor Details

    • FuzzyQueryCommand

      public FuzzyQueryCommand()
      Default constructor.
  • Method Details

    • getQueryClassName

      protected String getQueryClassName()
      Description copied from class: QueryCommand
      Gets the class name of the query this command handles.
      Specified by:
      getQueryClassName in class QueryCommand
      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:
      execute in class QueryCommand
      Parameters:
      context - the query context containing search configuration
      query - 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 mappings
      fuzzyQuery - the Lucene FuzzyQuery to convert
      boost - the boost factor to apply
      Returns:
      OpenSearch QueryBuilder configured for fuzzy matching