org.apache.solr.common
Class SolrInputDocument

java.lang.Object
  extended by org.apache.solr.common.SolrInputDocument
All Implemented Interfaces:
Serializable, Iterable<SolrInputField>

public class SolrInputDocument
extends Object
implements Iterable<SolrInputField>, Serializable

Represent the field and boost information needed to construct and index a Lucene Document. Like the SolrDocument, the field values should match those specified in schema.xml

Since:
solr 1.3
Version:
$Id: SolrInputDocument.java 604951 2007-12-17 18:14:38Z ryan $
See Also:
Serialized Form

Constructor Summary
SolrInputDocument()
           
 
Method Summary
 void addField(String name, Object value)
          Add a field with implied null value for boost.
 void addField(String name, Object value, float boost)
          Remove all fields and boosts from the document
 void clear()
          Remove all fields and boosts from the document
 float getDocumentBoost()
           
 SolrInputField getField(String field)
           
 Collection<String> getFieldNames()
          Get all field names.
 Object getFieldValue(String name)
          Get the first value for a field.
 Collection<Object> getFieldValues(String name)
          Get all the values for a field.
 Iterator<SolrInputField> iterator()
           
 SolrInputField removeField(String name)
          Remove a field from the document
 void setDocumentBoost(float documentBoost)
           
 void setField(String name, Object value)
          Set a field with implied null value for boost.
 void setField(String name, Object value, float boost)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SolrInputDocument

public SolrInputDocument()
Method Detail

clear

public void clear()
Remove all fields and boosts from the document


addField

public void addField(String name,
                     Object value)
Add a field with implied null value for boost.

Parameters:
name - name of the field to add
value - value of the field
See Also:
addField(String, Object, float)

getFieldValue

public Object getFieldValue(String name)
Get the first value for a field.

Parameters:
name - name of the field to fetch
Returns:
first value of the field or null if not present

getFieldValues

public Collection<Object> getFieldValues(String name)
Get all the values for a field.

Parameters:
name - name of the field to fetch
Returns:
value of the field or null if not set

getFieldNames

public Collection<String> getFieldNames()
Get all field names.

Returns:
Set of all field names.

setField

public void setField(String name,
                     Object value)
Set a field with implied null value for boost.

Parameters:
name - name of the field to set
value - value of the field
See Also:
setField(String, Object, float)

setField

public void setField(String name,
                     Object value,
                     float boost)

addField

public void addField(String name,
                     Object value,
                     float boost)
Remove all fields and boosts from the document


removeField

public SolrInputField removeField(String name)
Remove a field from the document

Parameters:
name - The field name whose field is to be removed from the document
Returns:
the previous field with name, or null if there was no field for key.

getField

public SolrInputField getField(String field)

iterator

public Iterator<SolrInputField> iterator()
Specified by:
iterator in interface Iterable<SolrInputField>

getDocumentBoost

public float getDocumentBoost()

setDocumentBoost

public void setDocumentBoost(float documentBoost)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 Apache Software Foundation. All Rights Reserved.