# phpman > man > Plucene::Index::SegmentsReader(3pm)

## NAME
    [Plucene::Index::SegmentsReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsReader/markdown) - reads the segments

## SYNOPSIS
            my $segs_reader = [Plucene::Index::SegmentsReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsReader/markdown)
                    ->new($dir, [Plucene::Index::SegmentReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentReader/markdown) @readers);

            my $num_docs = $segs_reader->num_docs;
            my $doc = $segs_reader->document($id);
            my $norms = $seg_reader->norms($field);
            my $doc_freq = $segs_reader->doc_freq($term);

            my [Plucene::Index::SegmentsTermEnum](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermEnum/markdown) $term_enum
                    = $segs_reader->terms($term);
            my [Plucene::Index::SegmentsTermDocs](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermDocs/markdown) $term_docs
                    = $segs_reader->term_docs;
            my [Plucene::Index::SegmentsTermPositions](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermPositions/markdown) $term_positions
                    = $segs_reader->term_positions;

            if ($segs_reader->is_deleted($id)) { ... }

## DESCRIPTION
    This is the segments reader class.

## METHODS
  new
            my $segs_reader = [Plucene::Index::SegmentsReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsReader/markdown)
                    ->new($dir, [Plucene::Index::SegmentReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentReader/markdown) @readers);

    This will create a new [Plucene::Index::SegmentsReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsReader/markdown) object with the passed directory and
    [Plucene::Index::SegmentReader](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentReader/markdown) objects.

  num_docs
            my $num_docs = $segs_reader->num_docs;

    This will return the number of documents in all the segments in the Reader.

  document
            my $doc = $segs_reader->document($id);

    This will return the document at the passed document id.

  is_deleted
            if ($segs_reader->is_deleted($id)) { ... }

  norms
            my $norms = $seg_reader->norms($field);

    This returns the norms for the passed field.

  terms
            my [Plucene::Index::SegmentsTermEnum](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermEnum/markdown) $term_enum
                    = $segs_reader->terms($term);

    This will return the [Plucene::Index::SegmentsTermEnum](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermEnum/markdown) onject for the passed in term.

  doc_freq
            my $doc_freq = $segs_reader->doc_freq($term);

    This returns the number of documents containing the passed term.

  term_docs
            my [Plucene::Index::SegmentsTermDocs](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermDocs/markdown) $term_docs
                    = $segs_reader->term_docs;

    This will return the [Plucene::Index::SegmentsTermDocs](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermDocs/markdown) object.

  term_positions
            my [Plucene::Index::SegmentsTermPositions](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermPositions/markdown) $term_positions
                    = $segs_reader->term_positions;

    This will return the [Plucene::Index::SegmentsTermPositions](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ASegmentsTermPositions/markdown) object.

