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 aBooleanQueryFactorywith the specifiedSearchQueriesas initial values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMust(BooleanQueryFactory factory) Adds the specifiedBooleanQueryFactoryto the "must match" criteria after callingtoBooleanQuery()on it.voidaddMust(SearchQuery query) Adds the specifiedSearchQueryto the "must match" criteria.voidaddMust(Collection<? extends SearchQuery> queries) Adds the specifiedCollection<SearchQuery>to the "must match" criteria.voidaddMustNot(BooleanQueryFactory factory) Adds the specifiedBooleanQueryFactoryto the "must not match" criteria after callingtoBooleanQuery()on it.voidaddMustNot(SearchQuery query) Adds the specifiedSearchQueryto the "must not match" criteria.voidaddMustNot(Collection<? extends SearchQuery> queries) Adds the specifiedCollection<SearchQuery>to the "must not match" criteria.voidaddShould(BooleanQueryFactory factory) Adds the specifiedBooleanQueryFactoryto the "should match" criteria after callingtoBooleanQuery()on it.voidaddShould(SearchQuery query) Adds the specifiedSearchQueryto the "should match" criteria.voidaddShould(Collection<? extends SearchQuery> queries) Adds the specifiedCollection<SearchQuery>to the "should match" criteria.booleanisEmpty()Returns true if the currentBooleanQueryFactoryis empty; that is, if noSearchQuerieshave been added to it.voidmerge(BooleanQueryFactory result) Merges the specifiedBooleanQueryFactorywith the current one.Returns aBooleanQueryinstance 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 aBooleanQueryFactorywith the specifiedSearchQueriesas initial values.- Parameters:
must- queries that must matchshould- queries that should matchmustNot- queries that must not match
-
-
Method Details
-
toBooleanQuery
Returns aBooleanQueryinstance using the current state of thisBooleanQueryFactory.- Returns:
- a
BooleanQueryinstance reflecting the current state
-
addMust
Adds the specifiedSearchQueryto the "must match" criteria.- Parameters:
query- theSearchQueryto add
-
addMust
Adds the specifiedCollection<SearchQuery>to the "must match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addMust
Adds the specifiedBooleanQueryFactoryto the "must match" criteria after callingtoBooleanQuery()on it. Empty or null factories are silently ignored.- Parameters:
factory- theBooleanQueryFactoryto add- Since:
- 2.10
-
addShould
Adds the specifiedSearchQueryto the "should match" criteria.- Parameters:
query- theSearchQueryto add
-
addShould
Adds the specifiedCollection<SearchQuery>to the "should match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addShould
Adds the specifiedBooleanQueryFactoryto the "should match" criteria after callingtoBooleanQuery()on it. Empty or null factories are silently ignored.- Parameters:
factory- theBooleanQueryFactoryto add- Since:
- 2.10
-
addMustNot
Adds the specifiedSearchQueryto the "must not match" criteria.- Parameters:
query- theSearchQueryto add
-
addMustNot
Adds the specifiedCollection<SearchQuery>to the "must not match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addMustNot
Adds the specifiedBooleanQueryFactoryto the "must not match" criteria after callingtoBooleanQuery()on it. Empty or null factories are silently ignored.- Parameters:
factory- theBooleanQueryFactoryto add- Since:
- 2.10
-
merge
Merges the specifiedBooleanQueryFactorywith the current one.- Parameters:
result- theBooleanQueryFactoryto merge- Throws:
IllegalArgumentException- if result is null
-
isEmpty
public boolean isEmpty()Returns true if the currentBooleanQueryFactoryis empty; that is, if noSearchQuerieshave been added to it.- Returns:
- true if the current
BooleanQueryFactoryis empty. - Since:
- 2.10
-