## org.apache.lucene
Interface DocumentBuilder

All Known Implementing Classes:
  CategoryDocumentBuilder, EnhancementsDocumentBuilder

    public interface DocumentBuilder

An interface which standardizes the process of building an indexable `Document`.

The idea is that implementations implement `build(Document doc)`, which adds to the given Document whatever `Field`s it wants to add. A DocumentBuilder is also allowed to inspect or change existing Fields in the Document, if it wishes to.

Implementations should normally have a constructor with parameters which determine what `build(Document)` will add to doc.
To allow reuse of the DocumentBuilder object, implementations are also encouraged to have a setter method, which remembers its parameters just like the constructor. This setter method cannot be described in this interface, because it will take different parameters in each implementation.

The interface defines a builder pattern, which allows applications to invoke several document builders in the following way:

     builder1.build(builder2.build(builder3.build(new Document())));

WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary
`static class` `DocumentBuilder.DocumentBuilderException` An exception thrown from `DocumentBuilder`'s build().

Method Summary
`org.apache.lucene.document.Document` `build(org.apache.lucene.document.Document doc)` Adds to the given document whatever `Field`s the implementation needs to add.

Method Detail

### build

    org.apache.lucene.document.Document build(org.apache.lucene.document.Document doc)
                                              throws DocumentBuilder.DocumentBuilderException

  Adds to the given document whatever `Field`s the implementation needs to add. Return the docunment instance to allow for chaining calls.

  Throws:
    `DocumentBuilder.DocumentBuilderException`

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.