zacharymorn commented on a change in pull request #205:
URL: https://github.com/apache/lucene/pull/205#discussion_r665966533



##########
File path: lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
##########
@@ -57,7 +57,7 @@
   final NormsProducer normsProducer;
 
   final StoredFieldsReader fieldsReaderOrig;
-  final TermVectorsReader termVectorsReaderOrig;
+  final TermVectorsReaderBase termVectorsReaderOrig;

Review comment:
       >  I'm not really sure why there needs to be both TermVectorsReader & 
TermVectorsReaderBase any way but surely you & Adrien do so I leave that to 
your judgement.
   
   The main reason that we are adding a new index level API for TermVectors 
(`TermVectors` in the other PR) is that we would like to provide a new way of 
TV access from `IndexReader` like the following 
   
   ```
   TermVectors termVectors = reader.getTermVectorsReader(); // would clone the 
underlying TermVectorsReader to be 
    thread-safe, and GC-able once usage is finished
   
   for (int docId = 0; docId < numDocs; docId++) {
     Fields vectors = termVectors.get(docId);
   }
   ```
   
   to replace the old way of access in the form of
   
   ```
   for (int docId = 0; docId < numDocs; docId++) {
     Fields vectors = reader.getTermVectors(docId); // using thread-local to 
cache
   }
   ```
   
   as per https://github.com/apache/lucene/pull/137#issuecomment-840111367 . 
From my understanding, it's a bit like separating out the existing index level 
API `IndexReader#getTermVectors` into a new dedicated class to handle TV (and 
we do plan to deprecate the existing API once the new one is ready), and hence 
some of the internal index / codec classes organization details are now exposed 
via the indirection and inheritance relationships, and we need a bridge between 
them (by having codec class `TermVectrosReaderBase` to inherit the new index 
class `TermVectorsReader`).
   
   Not sure if @jpountz or @rmuir have any further suggestion on this? If 
there's no strong objection to the current approach in this PR and the other 
one https://github.com/apache/lucene/pull/180, we can potentially use 
https://issues.apache.org/jira/browse/LUCENE-10018 to further enhance on this?




-- 
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

Reply via email to