# man > Plucene::Document

## NAME
    [Plucene::Document](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument/markdown) - The unit of indexing and searching

## SYNOPSIS
            my $document = [Plucene::Document](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument/markdown)->new;

            $document->add( [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) $field);
            my [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) $field = $document->get($field_name);

            my [Plucene::Document::Fields](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AFields/markdown) @fields = $document->fields;

## DESCRIPTION
    Documents are the unit of indexing and search, and each document is a set of fields. Each field
    has a name and a textual value.

    A field may be stored with the document, in which case it is returned with search hits on the
    document. Thus each document should typically contain stored fields which uniquely identify it.

## METHODS
  get
            my [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) $field = $document->get($field_name);

    This returns the [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) object of the field with the given name if any exist
    in this document, or null.

  add
            $document->add( [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) $field);

    This will add a field to the document.

  fields
            my [Plucene::Document::Field](https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ADocument%3A%3AField/markdown) @fields = $document->fields;

    This returns an list of all the fields in a document.

