Class BooleanQueryFactory
- java.lang.Object
-
- com.atlassian.confluence.macro.query.BooleanQueryFactory
-
public final class BooleanQueryFactory extends Object
Container class for the results of aSearchQueryParseroperation, 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 aBooleanQueryFactorywith the specifiedSearchQueriesas initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMust(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.BooleanQuerytoBooleanQuery()Returns aBooleanQueryinstance 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 aBooleanQueryFactorywith the specifiedSearchQueriesas initial values.- Parameters:
must- queries that must matchshould- queries that should matchmustNot- queries that must not match
-
-
Method Detail
-
toBooleanQuery
public BooleanQuery toBooleanQuery()
Returns aBooleanQueryinstance using the current state of thisBooleanQueryFactory.- Returns:
- a
BooleanQueryinstance reflecting the current state
-
addMust
public void addMust(SearchQuery query)
Adds the specifiedSearchQueryto the "must match" criteria.- Parameters:
query- theSearchQueryto add
-
addMust
public void addMust(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>to the "must match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addMust
public void addMust(BooleanQueryFactory factory)
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
public void addShould(SearchQuery query)
Adds the specifiedSearchQueryto the "should match" criteria.- Parameters:
query- theSearchQueryto add
-
addShould
public void addShould(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>to the "should match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addShould
public void addShould(BooleanQueryFactory factory)
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
public void addMustNot(SearchQuery query)
Adds the specifiedSearchQueryto the "must not match" criteria.- Parameters:
query- theSearchQueryto add
-
addMustNot
public void addMustNot(Collection<? extends SearchQuery> queries)
Adds the specifiedCollection<SearchQuery>to the "must not match" criteria.- Parameters:
queries- theSearchQueriesto add
-
addMustNot
public void addMustNot(BooleanQueryFactory factory)
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
public void merge(BooleanQueryFactory result)
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
-
-