com.atlassian.confluence.macro.query
Class BooleanQueryFactory

java.lang.Object
  extended by com.atlassian.confluence.macro.query.BooleanQueryFactory

public final class BooleanQueryFactory
extends Object

Container class for the results of a SearchQueryParser operation, providing a mutable version of the BooleanQuery.

Since:
2.9

Constructor Summary
BooleanQueryFactory()
          Constructs an empty BooleanQueryFactory.
BooleanQueryFactory(Set<SearchQuery> must, Set<SearchQuery> should, Set<SearchQuery> mustNot)
          Constructs a BooleanQueryFactory with the specified SearchQueries as initial values.
 
Method Summary
 void addMust(BooleanQueryFactory factory)
          Adds the specified BooleanQueryFactory to the "must match" criteria after calling toBooleanQuery() on it.
 void addMust(Collection<? extends SearchQuery> queries)
          Adds the specified Collection<SearchQuery> to the "must match" criteria.
 void addMust(SearchQuery query)
          Adds the specified SearchQuery to the "must match" criteria.
 void addMustNot(BooleanQueryFactory factory)
          Adds the specified BooleanQueryFactory to the "must not match" criteria after calling toBooleanQuery() on it.
 void addMustNot(Collection<? extends SearchQuery> queries)
          Adds the specified Collection<SearchQuery> to the "must not match" criteria.
 void addMustNot(SearchQuery query)
          Adds the specified SearchQuery to the "must not match" criteria.
 void addShould(BooleanQueryFactory factory)
          Adds the specified BooleanQueryFactory to the "should match" criteria after calling toBooleanQuery() on it.
 void addShould(Collection<? extends SearchQuery> queries)
          Adds the specified Collection<SearchQuery> to the "should match" criteria.
 void addShould(SearchQuery query)
          Adds the specified SearchQuery to the "should match" criteria.
 boolean isEmpty()
          Returns true if the current BooleanQueryFactory is empty; that is, if no SearchQueries have been added to it.
 void merge(BooleanQueryFactory result)
          Merges the specified BooleanQueryFactory with the current one.
 BooleanQuery toBooleanQuery()
          Returns a BooleanQuery instance using the current state of this BooleanQueryFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanQueryFactory

public BooleanQueryFactory()
Constructs an empty BooleanQueryFactory.


BooleanQueryFactory

public BooleanQueryFactory(Set<SearchQuery> must,
                           Set<SearchQuery> should,
                           Set<SearchQuery> mustNot)
Constructs a BooleanQueryFactory with the specified SearchQueries as initial values.

Parameters:
must - queries that must match
should - queries that should match
mustNot - queries that must not match
Method Detail

toBooleanQuery

public BooleanQuery toBooleanQuery()
Returns a BooleanQuery instance using the current state of this BooleanQueryFactory.

Returns:
a BooleanQuery instance reflecting the current state

addMust

public void addMust(SearchQuery query)
Adds the specified SearchQuery to the "must match" criteria.

Parameters:
query - the SearchQuery to add

addMust

public void addMust(Collection<? extends SearchQuery> queries)
Adds the specified Collection<SearchQuery> to the "must match" criteria.

Parameters:
queries - the SearchQueries to add

addMust

public void addMust(BooleanQueryFactory factory)
Adds the specified BooleanQueryFactory to the "must match" criteria after calling toBooleanQuery() on it. Empty or null factories are silently ignored.

Parameters:
factory - the BooleanQueryFactory to add
Since:
2.10

addShould

public void addShould(SearchQuery query)
Adds the specified SearchQuery to the "should match" criteria.

Parameters:
query - the SearchQuery to add

addShould

public void addShould(Collection<? extends SearchQuery> queries)
Adds the specified Collection<SearchQuery> to the "should match" criteria.

Parameters:
queries - the SearchQueries to add

addShould

public void addShould(BooleanQueryFactory factory)
Adds the specified BooleanQueryFactory to the "should match" criteria after calling toBooleanQuery() on it. Empty or null factories are silently ignored.

Parameters:
factory - the BooleanQueryFactory to add
Since:
2.10

addMustNot

public void addMustNot(SearchQuery query)
Adds the specified SearchQuery to the "must not match" criteria.

Parameters:
query - the SearchQuery to add

addMustNot

public void addMustNot(Collection<? extends SearchQuery> queries)
Adds the specified Collection<SearchQuery> to the "must not match" criteria.

Parameters:
queries - the SearchQueries to add

addMustNot

public void addMustNot(BooleanQueryFactory factory)
Adds the specified BooleanQueryFactory to the "must not match" criteria after calling toBooleanQuery() on it. Empty or null factories are silently ignored.

Parameters:
factory - the BooleanQueryFactory to add
Since:
2.10

merge

public void merge(BooleanQueryFactory result)
Merges the specified BooleanQueryFactory with the current one.

Parameters:
result - the BooleanQueryFactory to merge
Throws:
IllegalArgumentException - if result is null

isEmpty

public boolean isEmpty()
Returns true if the current BooleanQueryFactory is empty; that is, if no SearchQueries have been added to it.

Returns:
true if the current BooleanQueryFactory is empty.
Since:
2.10


Copyright © 2003–2015 Atlassian. All rights reserved.