Class TermQueryCommand

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

public class TermQueryCommand extends QueryCommand
Command class for handling term query execution and conversion. This class processes Lucene TermQuery objects and converts them to OpenSearch QueryBuilder instances.
  • Constructor Details

    • TermQueryCommand

      public TermQueryCommand()
      Default constructor for TermQueryCommand.
  • 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)
      Description copied from class: QueryCommand
      Executes the query command and returns a QueryBuilder.
      Specified by:
      execute in class QueryCommand
      Parameters:
      context - The query context containing search parameters.
      query - The Lucene query to execute.
      boost - The boost factor to apply.
      Returns:
      The executed QueryBuilder.
    • convertTermQuery

      protected org.opensearch.index.query.QueryBuilder convertTermQuery(QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost)
      Converts a TermQuery to a QueryBuilder with the given boost value.
      Parameters:
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      Returns:
      the converted QueryBuilder
    • convertTermQuery

      protected org.opensearch.index.query.QueryBuilder convertTermQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a TermQuery to a QueryBuilder with field-specific handling.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertTextQuery

      protected org.opensearch.index.query.QueryBuilder convertTextQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a term query to a text-based match phrase query.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertKeywordQuery

      protected org.opensearch.index.query.QueryBuilder convertKeywordQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a term query to a keyword-based exact term query.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertWildcardQuery

      protected org.opensearch.index.query.QueryBuilder convertWildcardQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a term query to a wildcard query for URL field matching.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertPrefixQuery

      protected org.opensearch.index.query.QueryBuilder convertPrefixQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a term query ending with asterisk to a prefix query.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertSortQuery

      protected org.opensearch.index.query.QueryBuilder convertSortQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a sort field query to add sort criteria to the context.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      null as this method only adds sort criteria
    • convertDefaultTermQuery

      protected org.opensearch.index.query.QueryBuilder convertDefaultTermQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a term query for the default field with fuzzy matching support.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder
    • convertSiteQuery

      protected org.opensearch.index.query.QueryBuilder convertSiteQuery(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, QueryContext context, org.apache.lucene.search.TermQuery termQuery, float boost, String field, String text)
      Converts a site field query to a prefix query for site filtering.
      Parameters:
      fessConfig - the Fess configuration
      context - the query context
      termQuery - the term query to convert
      boost - the boost value to apply
      field - the field name
      text - the query text
      Returns:
      the converted QueryBuilder