JoeHF commented on code in PR #1003: URL: https://github.com/apache/lucene/pull/1003#discussion_r925768424
########## lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java: ########## @@ -98,6 +100,16 @@ public void doubleField(FieldInfo fieldInfo, double value) { @Override public Status needsField(FieldInfo fieldInfo) throws IOException { + // return stop after collected all needed fields + if (fieldsToAdd != null + && !fieldsToAdd.contains(fieldInfo.name) + && fieldsToAdd.size() + == doc.getFields().stream() + .map(IndexableField::name) + .collect(Collectors.toSet()) + .size()) { + return Status.STOP; Review Comment: you are right, produced errors in test case https://github.com/apache/lucene/pull/1003/files#diff-4439cae82856043dfe05c058daac8c23433110d9b0cf7a783edf0b63c1bc423dR100 The only way i can think of is to sort field name before writing stored field so that multiple values for the same field are close to each other. Only in that sorting cases we can stop early. But this reader mode is not back-compatible for the old stored file. How do we solve this issue? or do we have other easy options to return early? @jpountz -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org