# Plucene::Search::DateFilter - Restrict searches to given time periods - perldoc - [phpMan]

## NAME
    [Plucene::Search::DateFilter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ASearch%3A%3ADateFilter/markdown) - Restrict searches to given time periods

## SYNOPSIS
            my $filter = [Plucene::Search::DateFilter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ASearch%3A%3ADateFilter/markdown)->new({
                    field => "date",
                    from  => [Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $from,
                    to    => [Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $to
            })
            my $hits = $searcher->search($query, $filter);

## DESCRIPTION
    This class can restrict the results of a search to a set of dates. This requires a field to have
    been indexed using [Plucene::Document::DateSerializer](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3ADateSerializer/markdown). See the documentation for that module for
    how to do this.

## METHODS
  new
            my $filter = [Plucene::Search::DateFilter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ASearch%3A%3ADateFilter/markdown)->new({
                    field => "date",
                    from  => [Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $from,
                    to    => [Time::Piece](https://www.chedong.com/phpMan.php/perldoc/Time%3A%3APiece/markdown) $to
            })

    This creates a new filter. Either of "from" or "to" are optional.

  bits
    This is used by the searcher to iterate over the documents and return a bitfield specifying
    which documents are included in the range.

