Class BooleanQueryFactory
java.lang.Object
com.atlassian.confluence.macro.query.BooleanQueryFactory
Container class for the results of a
SearchQueryParser
operation,
providing a mutable version of the BooleanQuery
.- Since:
- 2.9
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an emptyBooleanQueryFactory
.BooleanQueryFactory
(Set<SearchQuery> must, Set<SearchQuery> should, Set<SearchQuery> mustNot) Constructs aBooleanQueryFactory
with the specifiedSearchQueries
as initial values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Returns aBooleanQuery
instance using the current state of thisBooleanQueryFactory
.
-
Constructor Details
-
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 Details
-
toBooleanQuery
Returns aBooleanQuery
instance using the current state of thisBooleanQueryFactory
.- Returns:
- a
BooleanQuery
instance reflecting the current state
-
addMust
Adds the specifiedSearchQuery
to the "must match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addMust
Adds the specifiedCollection<SearchQuery>
to the "must match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addMust
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
Adds the specifiedSearchQuery
to the "should match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addShould
Adds the specifiedCollection<SearchQuery>
to the "should match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addShould
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
Adds the specifiedSearchQuery
to the "must not match" criteria.- Parameters:
query
- theSearchQuery
to add
-
addMustNot
Adds the specifiedCollection<SearchQuery>
to the "must not match" criteria.- Parameters:
queries
- theSearchQueries
to add
-
addMustNot
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
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
-