Class | Ferret::Search::BooleanQuery::BooleanClause
In: | ext/r_search.c
Parent: | Object

## Summary

A BooleanClause holes a single query within a BooleanQuery specifying wither the query +:must+ match, +:should+ match or +:must_not+ match. BooleanClauses can be used to pass a clause from one BooleanQuery to another although it is generally easier just to add a query directly to a BooleanQuery using the BooleanQuery#add_query method.

## Example

      clause1 = BooleanClause.new(query1, :should)
      clause2 = BooleanClause.new(query2, :should)

      query = BooleanQuery.new
      query << clause1 << clause2

### Methods

new occur= prohibited? query query= required? to_s

### Public Class methods

BooleanClause.new(query, occur = :should) → BooleanClause

Create a new BooleanClause object, wrapping the query `query`. `occur` must be one of +:must+, +:should+ or +:must_not+.

### Public Instance methods

clause.occur = occur → occur

Set the `occur` value for this BooleanClause. `occur` must be one of +:must+, +:should+ or +:must_not+.

clause.prohibited? → bool

Return true if this clause is prohibited. ie, this will be true if occur was equal to +:must_not+.

clause.query → query

Return the query object wrapped by this BooleanClause.

clause.query = query → query

Set the query wrapped by this BooleanClause.

clause.required? → bool

Return true if this clause is required. ie, this will be true if occur was equal to +:must+.

clause.to_s → string

Return a string representation of this clause. This will not be used by BooleanQuery#to_s. It is only used by BooleanClause#to_s and will specify whether the clause is +:must+, +:should+ or +:must_not+.

[Validate]