@InjectableComponent public class

QueryVisitor

extends Object
java.lang.Object
   ↳ com.atlassian.jira.jql.query.QueryVisitor

Class Overview

Used to generate the Lucene query from a Query. This visits the nodes of the tree and creates a lucene query based on its structure. Users of this class should only call createQuery(Clause, QueryCreationContext) and not use the visitor directly as the query in a QueryFactoryResult may not be valid.

Summary

Nested Classes
class QueryVisitor.QueryVisitorFactory  
Fields
protected final ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory
Public Constructors
QueryVisitor(ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory, WorklogClausesTransformerVisitor.Factory worklogsVisitorFactory, DeMorgansVisitor.DeMorgansVisitorFactory deMorgansVisitorFactory)
Public Methods
Query createQuery(Clause clause, QueryCreationContext queryCreationContext)
Create a lucene query for the passed clause.
Protected Methods
ContextAwareQueryVisitor createContextAwareQueryVisitor(QueryCreationContext queryCreationContext, Clause clause)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory

Public Constructors

public QueryVisitor (ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory, WorklogClausesTransformerVisitor.Factory worklogsVisitorFactory, DeMorgansVisitor.DeMorgansVisitorFactory deMorgansVisitorFactory)

Public Methods

public Query createQuery (Clause clause, QueryCreationContext queryCreationContext)

Create a lucene query for the passed clause.

NOTE: The query generated by this method will probably not run in Lucene even though it is correct. Lucene has some quirks when dealing with negative queries. Lucene will not search for negative queries, it will only filter the results from a positive query (e.g. +project:monkey -status:blocker will work while -status:blocker will not).

NOTE: This visitor will push all instances of the NotClause out of the tree by using the DeMorgansVisitor so that the terminal clauses will handle all the negation logic and the visitor does not need to deal with NOT's.

Parameters
clause the clause to process.
Returns
  • the generated lucene query.

Protected Methods

protected ContextAwareQueryVisitor createContextAwareQueryVisitor (QueryCreationContext queryCreationContext, Clause clause)