Class BooleanQueryFactory
- java.lang.Object
-
- com.atlassian.confluence.macro.query.BooleanQueryFactory
-
public final class BooleanQueryFactory extends Object
Container class for the results of aSearchQueryParser
operation, providing a mutable version of theBooleanQuery
.- Since:
- 2.9
-
-
Constructor Summary
Constructors Constructor Description BooleanQueryFactory()
Constructs an emptyBooleanQueryFactory
.BooleanQueryFactory(Set<SearchQuery> must, Set<SearchQuery> should, Set<SearchQuery> mustNot)
Constructs aBooleanQueryFactory
with the specifiedSearchQueries
as initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMust(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "must match" criteria after callingtoBooleanQuery()
on it.void
addMust(SearchQuery query)
Adds the specifiedSearchQuery
to the "must match" criteria.void
addMust(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "must match" criteria.void
addMustNot(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "must not match" criteria after callingtoBooleanQuery()
on it.void
addMustNot(SearchQuery query)
Adds the specifiedSearchQuery
to the "must not match" criteria.void
addMustNot(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "must not match" criteria.void
addShould(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "should match" criteria after callingtoBooleanQuery()
on it.void
addShould(SearchQuery query)
Adds the specifiedSearchQuery
to the "should match" criteria.void
addShould(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "should match" criteria.boolean
isEmpty()
Returns true if the currentBooleanQueryFactory
is empty; that is, if noSearchQueries
have been added to it.void
merge(BooleanQueryFactory result)
Merges the specifiedBooleanQueryFactory
with the current one.BooleanQuery
toBooleanQuery()
Returns aBooleanQuery
instance using the current state of thisBooleanQueryFactory
.
-
-
-
Constructor Detail
-
BooleanQueryFactory
public BooleanQueryFactory()
Constructs an emptyBooleanQueryFactory
.
-
BooleanQueryFactory
public BooleanQueryFactory(Set<SearchQuery> must, Set<SearchQuery> should, Set<SearchQuery> mustNot)
Constructs aBooleanQueryFactory
with the specifiedSearchQueries
as initial values.- Parameters:
must
- queries that must matchshould
- queries that should matchmustNot
- queries that must not match
-
-
Method Detail
-
toBooleanQuery
public BooleanQuery toBooleanQuery()
Returns aBooleanQuery
instance using the current state of thisBooleanQueryFactory
.- Returns:
- a
BooleanQuery
instance reflecting the current state
-
addMust
public void addMust(SearchQuery query)
Adds the specifiedSearchQuery
to the "must match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addMust
public void addMust(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "must match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addMust
public void addMust(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "must match" criteria after callingtoBooleanQuery()
on it. Empty or null factories are silently ignored.- Parameters:
factory
- theBooleanQueryFactory
to add- Since:
- 2.10
-
addShould
public void addShould(SearchQuery query)
Adds the specifiedSearchQuery
to the "should match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addShould
public void addShould(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "should match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addShould
public void addShould(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "should match" criteria after callingtoBooleanQuery()
on it. Empty or null factories are silently ignored.- Parameters:
factory
- theBooleanQueryFactory
to add- Since:
- 2.10
-
addMustNot
public void addMustNot(SearchQuery query)
Adds the specifiedSearchQuery
to the "must not match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addMustNot
public void addMustNot(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>
to the "must not match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addMustNot
public void addMustNot(BooleanQueryFactory factory)
Adds the specifiedBooleanQueryFactory
to the "must not match" criteria after callingtoBooleanQuery()
on it. Empty or null factories are silently ignored.- Parameters:
factory
- theBooleanQueryFactory
to add- Since:
- 2.10
-
merge
public void merge(BooleanQueryFactory result)
Merges the specifiedBooleanQueryFactory
with the current one.- Parameters:
result
- theBooleanQueryFactory
to merge- Throws:
IllegalArgumentException
- if result is null
-
isEmpty
public boolean isEmpty()
Returns true if the currentBooleanQueryFactory
is empty; that is, if noSearchQueries
have been added to it.- Returns:
- true if the current
BooleanQueryFactory
is empty. - Since:
- 2.10
-
-