Package org.apache.solr.common
Class SolrInputDocument
- java.lang.Object
- 
- org.apache.solr.common.SolrDocumentBase<SolrInputField,SolrInputDocument>
- 
- org.apache.solr.common.SolrInputDocument
 
 
- 
- All Implemented Interfaces:
- Serializable,- Iterable<SolrInputField>,- Map<String,SolrInputField>,- MapSerializable,- MapWriter,- NavigableObject
 
 public class SolrInputDocument extends SolrDocumentBase<SolrInputField,SolrInputDocument> implements Iterable<SolrInputField> Represent the field-value 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
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description SolrInputDocument(String... fields)SolrInputDocument(Map<String,SolrInputField> fields)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildDocument(SolrInputDocument child)voidaddChildDocuments(Collection<SolrInputDocument> children)voidaddField(String name, Object value)Add a field value to any existing values that may or may not exist.voidclear()Remove all fields from the documentbooleancontainsKey(Object key)booleancontainsValue(Object value)SolrInputDocumentdeepCopy()Set<Map.Entry<String,SolrInputField>>entrySet()SolrInputFieldget(Object key)intgetChildDocumentCount()The anonymous child document count.List<SolrInputDocument>getChildDocuments()Returns the list of child documents, or null if none.SolrInputFieldgetField(String field)Collection<String>getFieldNames()Get all field names.ObjectgetFieldValue(String name)Get the first value for a field.Collection<Object>getFieldValues(String name)Get all the values for a field.booleanhasChildDocuments()Has anonymous children?booleanisEmpty()Iterator<SolrInputField>iterator()Set<String>keySet()SolrInputFieldput(String key, SolrInputField value)voidputAll(Map<? extends String,? extends SolrInputField> t)SolrInputFieldremove(Object key)SolrInputFieldremoveField(String name)Remove a field from the documentvoidsetField(String name, Object value)Set a field value; replacing the existing value if present.intsize()StringtoString()Collection<SolrInputField>values()voidwriteMap(MapWriter.EntryWriter ew)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.IterableforEach, spliterator
 - 
Methods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
 - 
Methods inherited from interface org.apache.solr.common.NavigableObject_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
 
- 
 
- 
- 
- 
Constructor Detail- 
SolrInputDocumentpublic SolrInputDocument(String... fields) 
 - 
SolrInputDocumentpublic SolrInputDocument(Map<String,SolrInputField> fields) 
 
- 
 - 
Method Detail- 
writeMappublic void writeMap(MapWriter.EntryWriter ew) throws IOException - Specified by:
- writeMapin interface- MapWriter
- Throws:
- IOException
 
 - 
clearpublic void clear() Remove all fields from the document- Specified by:
- clearin interface- Map<String,SolrInputField>
 
 - 
addFieldpublic void addField(String name, Object value) Add a field value to any existing values that may or may not exist. The class type of value and the name parameter should match schema.xml. schema.xml can be found in conf directory under the solr home by default.- Specified by:
- addFieldin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
- Parameters:
- name- Name of the field, should match one of the field names defined under "fields" tag in schema.xml.
- value- Value of the field, should be of same class type as defined by "type" attribute of the corresponding field in schema.xml.
 
 - 
getFieldValuepublic Object getFieldValue(String name) Get the first value for a field.- Specified by:
- getFieldValuein class- SolrDocumentBase<SolrInputField,SolrInputDocument>
- Parameters:
- name- name of the field to fetch
- Returns:
- first value of the field or null if not present
 
 - 
getFieldValuespublic Collection<Object> getFieldValues(String name) Get all the values for a field.- Specified by:
- getFieldValuesin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
- Parameters:
- name- name of the field to fetch
- Returns:
- value of the field or null if not set
 
 - 
getFieldNamespublic Collection<String> getFieldNames() Get all field names.- Specified by:
- getFieldNamesin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
- Returns:
- Set of all field names.
 
 - 
setFieldpublic void setField(String name, Object value) Set a field value; replacing the existing value if present.- Specified by:
- setFieldin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
- Parameters:
- name- name of the field to set
- value- value of the field
 
 - 
removeFieldpublic 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.
 
 - 
getFieldpublic SolrInputField getField(String field) 
 - 
iteratorpublic Iterator<SolrInputField> iterator() - Specified by:
- iteratorin interface- Iterable<SolrInputField>
 
 - 
deepCopypublic SolrInputDocument deepCopy() 
 - 
containsKeypublic boolean containsKey(Object key) - Specified by:
- containsKeyin interface- Map<String,SolrInputField>
 
 - 
containsValuepublic boolean containsValue(Object value) - Specified by:
- containsValuein interface- Map<String,SolrInputField>
 
 - 
entrySetpublic Set<Map.Entry<String,SolrInputField>> entrySet() - Specified by:
- entrySetin interface- Map<String,SolrInputField>
 
 - 
getpublic SolrInputField get(Object key) - Specified by:
- getin interface- Map<String,SolrInputField>
 
 - 
isEmptypublic boolean isEmpty() - Specified by:
- isEmptyin interface- Map<String,SolrInputField>
 
 - 
putpublic SolrInputField put(String key, SolrInputField value) - Specified by:
- putin interface- Map<String,SolrInputField>
 
 - 
putAllpublic void putAll(Map<? extends String,? extends SolrInputField> t) - Specified by:
- putAllin interface- Map<String,SolrInputField>
 
 - 
removepublic SolrInputField remove(Object key) - Specified by:
- removein interface- Map<String,SolrInputField>
 
 - 
sizepublic int size() - Specified by:
- sizein interface- Map<String,SolrInputField>
 
 - 
valuespublic Collection<SolrInputField> values() - Specified by:
- valuesin interface- Map<String,SolrInputField>
 
 - 
addChildDocumentpublic void addChildDocument(SolrInputDocument child) - Specified by:
- addChildDocumentin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
 
 - 
addChildDocumentspublic void addChildDocuments(Collection<SolrInputDocument> children) - Specified by:
- addChildDocumentsin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
 
 - 
getChildDocumentspublic List<SolrInputDocument> getChildDocuments() Returns the list of child documents, or null if none.- Specified by:
- getChildDocumentsin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
 
 - 
hasChildDocumentspublic boolean hasChildDocuments() Description copied from class:SolrDocumentBaseHas anonymous children?- Specified by:
- hasChildDocumentsin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
 
 - 
getChildDocumentCountpublic int getChildDocumentCount() Description copied from class:SolrDocumentBaseThe anonymous child document count.- Specified by:
- getChildDocumentCountin class- SolrDocumentBase<SolrInputField,SolrInputDocument>
 
 
- 
 
-