@InjectableComponent public class QueryVisitor extends Object
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(com.atlassian.query.clause.Clause, com.atlassian.jira.jql.query.QueryCreationContext)
and not
use the visitor directly as the query in a QueryFactoryResult
may not be valid.Modifier and Type | Class and Description |
---|---|
static class |
QueryVisitor.QueryVisitorFactory |
Modifier and Type | Field and Description |
---|---|
protected ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory |
contextAwareQueryVisitorFactory |
Constructor and Description |
---|
QueryVisitor(ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory,
WorklogClausesTransformerVisitor.Factory worklogsVisitorFactory,
DeMorgansVisitor.DeMorgansVisitorFactory deMorgansVisitorFactory) |
Modifier and Type | Method and Description |
---|---|
protected ContextAwareQueryVisitor |
createContextAwareQueryVisitor(QueryCreationContext queryCreationContext,
Clause clause) |
org.apache.lucene.search.Query |
createQuery(Clause clause,
QueryCreationContext queryCreationContext)
Create a lucene query for the passed clause.
|
protected final ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory
public QueryVisitor(ContextAwareQueryVisitor.ContextAwareQueryVisitorFactory contextAwareQueryVisitorFactory, WorklogClausesTransformerVisitor.Factory worklogsVisitorFactory, DeMorgansVisitor.DeMorgansVisitorFactory deMorgansVisitorFactory)
public org.apache.lucene.search.Query createQuery(Clause clause, QueryCreationContext queryCreationContext)
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.
clause
- the clause to process.protected ContextAwareQueryVisitor createContextAwareQueryVisitor(QueryCreationContext queryCreationContext, Clause clause)
Copyright © 2002-2017 Atlassian. All Rights Reserved.