Class DocsStreamer
- All Implemented Interfaces:
Iterator<org.apache.solr.common.SolrDocument>
-
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.solr.common.SolrDocumentconvertLuceneDocToSolrDoc(org.apache.lucene.document.Document doc, IndexSchema schema, ReturnFields fields) Converts the specifiedDocumentinto aSolrDocument.intstatic org.apache.solr.common.SolrDocumentexternalizeStoredValues(org.apache.solr.common.SolrDocument doc, IndexSchema schema) Replace LuceneIndexableFieldvalues on aSolrDocument(and nested / child documents) with the SolrJ-native objects that clients see after JavaBin deserialization.static ObjectgetValue(SchemaField sf, org.apache.lucene.index.IndexableField f) booleanhasNext()org.apache.solr.common.SolrDocumentnext()voidremove()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
KNOWN_TYPES
Deprecated.new field types should not be added to this list, instead useFieldType.ExternalizeStoredValuesAsObjectsA hardcoded list of known Solr field types that will be trusted to control their own conversion of stored field values into external Objects (viaFieldType.toObject(org.apache.lucene.index.IndexableField)) when returningSolrDocumentinstances to clients.For historic reasons, this Set is consulted using an equality basis, so subclasses of these "known" types are not given the same level of trust.
Any field type not found in this list will have stored values externalized as Strings using
FieldType.toExternal(org.apache.lucene.index.IndexableField)unless they implementFieldType.ExternalizeStoredValuesAsObjects
-
-
Constructor Details
-
DocsStreamer
-
-
Method Details
-
currentIndex
public int currentIndex() -
hasNext
public boolean hasNext() -
next
public org.apache.solr.common.SolrDocument next() -
convertLuceneDocToSolrDoc
public static org.apache.solr.common.SolrDocument convertLuceneDocToSolrDoc(org.apache.lucene.document.Document doc, IndexSchema schema, ReturnFields fields) Converts the specifiedDocumentinto aSolrDocument.The use of
ReturnFieldscan be important even when it was already used to retrieve theDocumentfromSolrDocumentFetcherbecause the Document may have been cached with more fields then are desired.- Parameters:
doc-Documentto be converted, must not be nullschema-IndexSchemacontaining the field/fieldType details for the index theDocumentcame from, must not be null.fields-ReturnFieldsinstance that can be use to limit the set of fields that will be converted, must not be null
-
remove
public void remove() -
externalizeStoredValues
public static org.apache.solr.common.SolrDocument externalizeStoredValues(org.apache.solr.common.SolrDocument doc, IndexSchema schema) Replace LuceneIndexableFieldvalues on aSolrDocument(and nested / child documents) with the SolrJ-native objects that clients see after JavaBin deserialization. The serialized JavaBin path already converts stored values through JavaBinResponseWriter.Resolver; this exists for the EmbeddedSolrServer streaming path, whose codec hands documents straight to the callback, soqueryAndStreamResponsematchesquery/HttpSolrClient.A stored value that cannot be converted is logged and omitted; conversion continues for the remaining values and fields.
Do not call this from
convertLuceneDocToSolrDoc(org.apache.lucene.document.Document, org.apache.solr.schema.IndexSchema, org.apache.solr.search.ReturnFields); JSON/XML writers and some transformers still expect stored fields asIndexableField.- See Also:
-
getValue
-
FieldType.ExternalizeStoredValuesAsObjects