public final class

BooleanQueryFactory

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.macro.query.BooleanQueryFactory

Class Overview

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

Summary

Public Constructors
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.
Public Methods
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(Collection<? extends SearchQuery> queries)
Adds the specified Collection<SearchQuery> to the "must not match" criteria.
void addMustNot(BooleanQueryFactory factory)
Adds the specified BooleanQueryFactory to the "must not match" criteria after calling toBooleanQuery() on it.
void addMustNot(SearchQuery query)
Adds the specified SearchQuery to the "must not match" criteria.
void addShould(SearchQuery query)
Adds the specified SearchQuery to the "should match" criteria.
void addShould(Collection<? extends SearchQuery> queries)
Adds the specified Collection<SearchQuery> to the "should match" criteria.
void addShould(BooleanQueryFactory factory)
Adds the specified BooleanQueryFactory to the "should match" criteria after calling toBooleanQuery() on it.
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public BooleanQueryFactory ()

Constructs an empty 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

Public Methods

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

public void addMust (Collection<? extends SearchQuery> queries)

Adds the specified Collection<SearchQuery> to the "must match" criteria.

Parameters
queries the SearchQueries to add

public void addMust (SearchQuery query)

Adds the specified SearchQuery to the "must match" criteria.

Parameters
query the SearchQuery to add

public void addMustNot (Collection<? extends SearchQuery> queries)

Adds the specified Collection<SearchQuery> to the "must not match" criteria.

Parameters
queries the SearchQueries to add

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

public void addMustNot (SearchQuery query)

Adds the specified SearchQuery to the "must not match" criteria.

Parameters
query the SearchQuery to add

public void addShould (SearchQuery query)

Adds the specified SearchQuery to the "should match" criteria.

Parameters
query the SearchQuery to add

public void addShould (Collection<? extends SearchQuery> queries)

Adds the specified Collection<SearchQuery> to the "should match" criteria.

Parameters
queries the SearchQueries to add

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

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.

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

public BooleanQuery toBooleanQuery ()

Returns a BooleanQuery instance using the current state of this BooleanQueryFactory.

Returns
  • a BooleanQuery instance reflecting the current state