Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11891

DocsStreamer populates SolrDocument w/unnecessary fields

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.4, 6.4.2, 6.6.2
    • 7.4, 8.0
    • Response Writers
    • None

    Description

      We observe that solr query time increases significantly with the number of rows requested,  even all we retrieve for each document is just fl=id,score.  Debugged a bit and see that most of the increased time was spent in BinaryResponseWriter,  converting lucene document into SolrDocument.  Inside convertLuceneDocToSolrDoc():   

      https://github.com/apache/lucene-solr/blob/df874432b9a17b547acb24a01d3491839e6a6b69/solr/core/src/java/org/apache/solr/response/DocsStreamer.java#L182 

      I am a bit puzzled why we need to iterate through all the fields in the document. Why can’t we just iterate through the requested field list?    

      https://github.com/apache/lucene-solr/blob/df874432b9a17b547acb24a01d3491839e6a6b69/solr/core/src/java/org/apache/solr/response/DocsStreamer.java#L156 

      e.g. when pass in the field list as 

      sdoc = convertLuceneDocToSolrDoc(doc, rctx.getSearcher().getSchema(), fnames)

      and just iterate through fnames,  there is a significant performance boost in our case.  

      Attachments

        1. SOLR-11891.patch.BAD
          14 kB
          Chris M. Hostetter
        2. SOLR-11891.patch
          17 kB
          Chris M. Hostetter
        3. DocsStreamer.java.diff
          2 kB
          wei wang

        Issue Links

          Activity

            People

              hossman Chris M. Hostetter
              weiwang19 wei wang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: