# Class: BooleanQuery

## helma.Search.BooleanQuery(String, String)

This class represents a Boolean Query, providing various methods for combining other Query instances using boolean operators.

## Constructor

#### new BooleanQuery(String, String)

Creates a new instance of helma.Search.BooleanQuery

##### Parameters:

Name | Type | Description
--- | --- | ---
`String` |  | name of the field
`String` |  | query string

Source:
  - helma/Search.js, line 891

##### Returns:

Object BooleanQuery object

### Extends

- helma.Search.Query

### Members

#### query :org.apache.lucene.search.BooleanQuery

Contains the wrapped BooleanQuery instance

##### Type:

- org.apache.lucene.search.BooleanQuery

Overrides:
  - helma.Search.Query#query
Source:
  - helma/Search.js, line 896

### Methods

#### addQuery(q, clause)

Adds an additional query clause to this query.

##### Parameters:

Name | Type | Description
--- | --- | ---
`q` | helma.Search.Query | The query to add
`clause` | String | Boolean clause ("or", "not", or "and", default is "and")

Source:
  - helma/Search.js, line 943

#### addTerm(field, str, clause, analyzer)

Adds a term to the wrapped query object. This method can be called with two, three or four arguments, eg.:

    addTerm("fieldname", "querystring")
    addTerm("fieldname", "querystring", "and")
    addTerm("fieldname", "querystring", helma.Search.getAnalyzer("de"))
    addTerm("fieldname", "querystring", "not", helma.Search.getAnalyzer("simple"))

##### Parameters:

Name | Type | Description
--- | --- | ---
`field` | String | Array | Either a String or an Array containing Strings that determine the index field(s) to match
`str` | String | Query string to match
`clause` | String | Boolean clause ("or", "not" or "and", default is "and")
`analyzer` | org.apache.lucene.analysis.Analyzer | An analyzer to use

Source:
  - helma/Search.js, line 922

#### getBoost()

Returns the boost factor of this query.

Inherited From:
  - helma.Search.Query#getBoost
Source:
  - helma/Search.js, line 845

#### getQuery()

Returns the wrapped Lucene Query object.

Inherited From:
  - helma.Search.Query#getQuery
Source:
  - helma/Search.js, line 832

##### Returns:

The wrapped query object

#### setBoost(fact)

Sets the boost factor of this query clause to the given number. Documents matching this query will have their score multiplied with the given factor

##### Parameters:

Name | Type | Description
--- | --- | ---
`fact` | Number | The factor to multiply the score of matching documents with.

Inherited From:
  - helma.Search.Query#setBoost
Source:
  - helma/Search.js, line 857