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,org.noggit.JSONWriter.Writable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSolrInputDocument(String... fields) SolrInputDocument(Map<String, SolrInputField> fields) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddChildDocuments(Collection<SolrInputDocument> children) voidAdd 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) deepCopy()entrySet()intDeprecated.Returns the list of child documents, or null if none.Get all field names.getFieldValue(String name) Get the first value for a field.getFieldValues(String name) Get all the values for a field.booleanHas anonymous children?booleanisEmpty()iterator()keySet()put(String key, SolrInputField value) voidputAll(Map<? extends String, ? extends SolrInputField> t) removeField(String name) Remove a field from the documentvoidSet a field value; replacing the existing value if present.intsize()toString()values()voidvisitSelfAndNestedDocs(BiConsumer<String, SolrInputDocument> consumer) Beta API; may change at will.voidWrites this object's entries out toew.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Constructor Details
-
SolrInputDocument
public SolrInputDocument() -
SolrInputDocument
-
SolrInputDocument
-
-
Method Details
-
writeMap
Description copied from interface:MapWriterWrites this object's entries out toew.- Specified by:
writeMapin interfaceMapWriter- Throws:
IOException
-
clear
public void clear()Remove all fields from the document- Specified by:
clearin interfaceMap<String,SolrInputField>
-
addField
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 classSolrDocumentBase<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.
-
getFieldValue
Get the first value for a field.- Specified by:
getFieldValuein classSolrDocumentBase<SolrInputField,SolrInputDocument> - Parameters:
name- name of the field to fetch- Returns:
- first value of the field or null if not present
-
getFieldValues
Get all the values for a field.- Specified by:
getFieldValuesin classSolrDocumentBase<SolrInputField,SolrInputDocument> - Parameters:
name- name of the field to fetch- Returns:
- value of the field or null if not set
-
getFieldNames
Get all field names.- Specified by:
getFieldNamesin classSolrDocumentBase<SolrInputField,SolrInputDocument> - Returns:
- Set of all field names.
-
setField
Set a field value; replacing the existing value if present.- Specified by:
setFieldin classSolrDocumentBase<SolrInputField,SolrInputDocument> - Parameters:
name- name of the field to setvalue- value of the field
-
removeField
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, ornullif there was no field forkey.
-
getField
-
iterator
- Specified by:
iteratorin interfaceIterable<SolrInputField>
-
toString
-
deepCopy
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,SolrInputField>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,SolrInputField>
-
entrySet
- Specified by:
entrySetin interfaceMap<String,SolrInputField>
-
get
- Specified by:
getin interfaceMap<String,SolrInputField>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<String,SolrInputField>
-
keySet
- Specified by:
keySetin interfaceMap<String,SolrInputField>
-
put
- Specified by:
putin interfaceMap<String,SolrInputField>
-
putAll
- Specified by:
putAllin interfaceMap<String,SolrInputField>
-
remove
- Specified by:
removein interfaceMap<String,SolrInputField>
-
size
public int size()- Specified by:
sizein interfaceMap<String,SolrInputField>
-
values
- Specified by:
valuesin interfaceMap<String,SolrInputField>
-
addChildDocument
- Specified by:
addChildDocumentin classSolrDocumentBase<SolrInputField,SolrInputDocument>
-
addChildDocuments
- Specified by:
addChildDocumentsin classSolrDocumentBase<SolrInputField,SolrInputDocument>
-
visitSelfAndNestedDocs
Beta API; may change at will. -
getChildDocuments
Returns the list of child documents, or null if none.- Specified by:
getChildDocumentsin classSolrDocumentBase<SolrInputField,SolrInputDocument>
-
hasChildDocuments
public boolean hasChildDocuments()Description copied from class:SolrDocumentBaseHas anonymous children?- Specified by:
hasChildDocumentsin classSolrDocumentBase<SolrInputField,SolrInputDocument>
-
getChildDocumentCount
Deprecated.Description copied from class:SolrDocumentBaseThe anonymous child document count.- Specified by:
getChildDocumentCountin classSolrDocumentBase<SolrInputField,SolrInputDocument>
-