Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/47#discussion_r69763447
  
    --- Diff: solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java 
---
    @@ -766,12 +766,16 @@ public Document doc(int i, Set<String> fields) throws 
IOException {
         }
     
         final DirectoryReader reader = getIndexReader();
    -    if (!enableLazyFieldLoading || fields == null) {
    -      d = reader.document(i);
    +    if (fields != null) {
    +      if (enableLazyFieldLoading) {
    +        final SetNonLazyFieldSelector visitor = new 
SetNonLazyFieldSelector(fields, reader, i);
    +        reader.document(i, visitor);
    +        d = visitor.doc;
    +      } else {
    +        d = reader.document(i, fields);
    --- End diff --
    
    This could lead to a bug when there is a document cache, since we'd cache a 
partial document without lazy loading.  Then imagine a subsequent 
doc(i,otherFields), is called and then a document is returned without those 
fields even if the doc on disk might actually has those fields.
    
    On line 770 if (enableLazyFieldLoading) could become: if 
(enableLazyFieldLoading || documentCache != null).  In this sense, 
"enableLazyFieldLoading" would have no effect unless there is no doc cache... 
I'm not sure what to think of that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to