# phpman > perldoc > Plucene::Index::DocumentWriter

## NAME
    [Plucene::Index::DocumentWriter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ADocumentWriter/markdown) - the document writer

## SYNOPSIS
            my $writer = [Plucene::Index::DocumentWriter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ADocumentWriter/markdown)
                    ->new($directory, $analyser, $max_field_length);

            $writer->add_document($segment, $doc);

## DESCRIPTION
    This is the document writer class.

  METHODS
  new
            my $writer = [Plucene::Index::DocumentWriter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ADocumentWriter/markdown)
                    ->new($directory, $analyser, $max_field_length);

    This will create a new [Plucene::Index::DocumentWriter](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3AIndex%3A%3ADocumentWriter/markdown) object with the passed in arguments.

  add_document
            $writer->add_document($segment, $doc);

