Class DocsStreamer

java.lang.Object
org.apache.solr.response.DocsStreamer
All Implemented Interfaces:
Iterator<org.apache.solr.common.SolrDocument>

public class DocsStreamer extends Object implements Iterator<org.apache.solr.common.SolrDocument>
This streams SolrDocuments from a DocList and applies transformer
  • Field Details

  • Constructor Details

  • Method Details

    • currentIndex

      public int currentIndex()
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<org.apache.solr.common.SolrDocument>
    • next

      public org.apache.solr.common.SolrDocument next()
      Specified by:
      next in interface Iterator<org.apache.solr.common.SolrDocument>
    • convertLuceneDocToSolrDoc

      public static org.apache.solr.common.SolrDocument convertLuceneDocToSolrDoc(org.apache.lucene.document.Document doc, IndexSchema schema, ReturnFields fields)
      Converts the specified Document into a SolrDocument.

      The use of ReturnFields can be important even when it was already used to retrieve the Document from SolrDocumentFetcher because the Document may have been cached with more fields then are desired.

      Parameters:
      doc - Document to be converted, must not be null
      schema - IndexSchema containing the field/fieldType details for the index the Document came from, must not be null.
      fields - ReturnFields instance that can be use to limit the set of fields that will be converted, must not be null
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<org.apache.solr.common.SolrDocument>
    • externalizeStoredValues

      public static org.apache.solr.common.SolrDocument externalizeStoredValues(org.apache.solr.common.SolrDocument doc, IndexSchema schema)
      Replace Lucene IndexableField values on a SolrDocument (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, so queryAndStreamResponse matches query / 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 as IndexableField.

      See Also:
    • getValue

      public static Object getValue(SchemaField sf, org.apache.lucene.index.IndexableField f)