Class | Ferret::Search::ConstantScoreQuery
In: | ext/r_search.c
Parent: | Ferret::Search::Query

## Summary

ConstantScoreQuery is a way to turn a Filter into a Query. It matches all documents that its filter matches with a constant score. This is a very fast query, particularly when run more than once (since filters are cached). It is also used internally be RangeQuery.

## Example

Let‘s say for example that you often need to display all documents created on or after June 1st. You could create a ConstantScoreQuery like this;

      query = ConstantScoreQuery.new(RangeFilter.new(:created_on, :>= => "200606"))

Once this is run once the results are cached and will be returned very quickly in future requests.

### Methods

new

### Public Class methods

ConstantScoreQuery.new(filter) → query

Create a ConstantScoreQuery which uses `filter` to match documents giving each document a constant score.

[Validate]