Class TermQueryFactory

java.lang.Object
com.atlassian.jira.search.jql.TermQueryFactory

@PublicApi public final class TermQueryFactory extends Object
This class is used to generate clauses to be added to boolean queries. Jira uses two custom fields to keep track of what fields are "visible" (to JQL) in a document, and what fields have missing value.

Since fields with missing values are not indexed, we keep the custom field 'nonemptyfieldids' up to date with all the field names in that document which don't have a value assigned to them. This is used for example in queries such as "value IS empty".

Since:
10.4
  • Method Details

    • visibilityQuery

      public static Query visibilityQuery(String fieldName)
      Parameters:
      fieldName - the index field to be visible
      Returns:
      the term query visiblefieldids:fieldName
    • wrapWithVisibilityQuery

      public static Query wrapWithVisibilityQuery(String fieldName, Query query)
      a utility method to wrap a query with a visibility query
      Parameters:
      fieldName - the index field to be visible
      query - the query to be wrapped
      Returns:
      a boolean query which includes the visibility query and the input query
    • nonEmptyQuery

      public static Query nonEmptyQuery(String fieldName)
      Parameters:
      fieldName - the index field to be non-empty
      Returns:
      the term query nonemptyfieldids:fieldName
    • emptyQuery

      public static Query emptyQuery(String fieldName)
      Parameters:
      fieldName - the index field to be empty
      Returns:
      the boolean query which includes the visibility query and the negative non-empty query