DocumentBuilder (Solr 3.6.2 API)
Keywords: org.apache.solr.update.DocumentBuilder class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.update
Class DocumentBuilder

    java.lang.Object
      org.apache.solr.update.DocumentBuilder

    public class DocumentBuilder

extends Object

Version:
  $Id: DocumentBuilder.java 1304001 2012-03-22 19:33:14Z hossman $

Constructor Summary
`DocumentBuilder(IndexSchema schema)`

Method Summary
`void` | `addField(SchemaField sfield, String val, float boost)` Add the specified `SchemaField` to the document.
`void` | `addField(String name, String val)` Add the Field and value to the document, invoking the copyField mechanism
`void` | `addField(String name, String val, float boost)` Add the Field and value to the document with the specified boost, invoking the copyField mechanism
`protected void` | `addSingleField(SchemaField sfield, String val, float boost)`
`void` | `endDoc()`
`Document` | `getDoc()`
`SolrDocument` | `loadStoredFields(SolrDocument doc, Document luceneDoc)` Deprecated. Do Not Use, see SolrPluginUtils.docListToSolrDocumentList instead
`void` | `setBoost(float boost)`
`void` | `startDoc()`
`static Document` | `toDocument(SolrInputDocument doc, IndexSchema schema)` Convert a SolrInputDocument to a lucene Document.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DocumentBuilder

    public DocumentBuilder(IndexSchema schema)

Method Detail

### startDoc

    public void startDoc()

### addSingleField

    protected void addSingleField(SchemaField sfield,
                                  String val,
                                  float boost)

### addField

    public void addField(SchemaField sfield,
                         String val,
                         float boost)

  Add the specified `SchemaField` to the document. Does not invoke the copyField mechanism.

  Parameters:
    `sfield` - The `SchemaField` to add
    `val` - The value to add
    `boost` - The boost factor
  See Also:
    `addField(String, String)`, `addField(String, String, float)`, `addSingleField(org.apache.solr.schema.SchemaField, String, float)`

### addField

    public void addField(String name,
                         String val)

  Add the Field and value to the document, invoking the copyField mechanism

  Parameters:
    `name` - The name of the field
    `val` - The value to add
  See Also:
    `addField(String, String, float)`, `addField(org.apache.solr.schema.SchemaField, String, float)`, `addSingleField(org.apache.solr.schema.SchemaField, String, float)`

### addField

    public void addField(String name,
                         String val,
                         float boost)

  Add the Field and value to the document with the specified boost, invoking the copyField mechanism

  Parameters:
    `name` - The name of the field.
    `val` - The value to add
    `boost` - The boost
  See Also:
    `addField(String, String)`, `addField(org.apache.solr.schema.SchemaField, String, float)`, `addSingleField(org.apache.solr.schema.SchemaField, String, float)`

### setBoost

    public void setBoost(float boost)

### endDoc

    public void endDoc()

### getDoc

    public Document getDoc()
                    throws IllegalArgumentException

  Throws:
    `IllegalArgumentException`

### toDocument

    public static Document toDocument(SolrInputDocument doc,
                                      IndexSchema schema)

  Convert a SolrInputDocument to a lucene Document. This function should go elsewhere. This builds the Document without an extra Map<> checking for multiple values. For more discussion, see: http://www.nabble.com/Re%3A-svn-commit%3A-r547493---in--lucene-solr-trunk%3A-.--src-java-org-apache-solr-common--src-java-org-apache-solr-schema--src-java-org-apache-solr-update--src-test-org-apache-solr-common--tf3931539.html TODO: /!\ NOTE /!\ This semantics of this function are still in flux. Something somewhere needs to be able to fill up a SolrDocument from a lucene document - this is one place that may happen. It may also be moved to an independent function

  Since:
    solr 1.3

### loadStoredFields

    @Deprecated
    public SolrDocument loadStoredFields(SolrDocument doc,
                                                    Document luceneDoc)

  Deprecated. Do Not Use, see SolrPluginUtils.docListToSolrDocumentList instead

  Deprecated, do not use: The semantics of this method make no sense, and have never made sense, this method will be removed in Solr 4.0

  See Also:
    `SolrPluginUtils.docListToSolrDocumentList(org.apache.solr.search.DocList, org.apache.solr.search.SolrIndexSearcher, java.util.Set, java.util.Map)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD