zacharymorn commented on a change in pull request #180:
URL: https://github.com/apache/lucene/pull/180#discussion_r654748459
##########
File path: lucene/core/src/java/org/apache/lucene/index/IndexReader.java
##########
@@ -307,8 +307,21 @@ public final int hashCode() {
/**
* Retrieve term vectors for this document, or null if term vectors were not
indexed. The returned
* Fields instance acts like a single-document inverted index (the docID
will be 0).
+ *
+ * @deprecated Use {@link IndexReader#getTermVectorsReader} instead.
*/
- public abstract Fields getTermVectors(int docID) throws IOException;
+ @Deprecated
+ public final Fields getTermVectors(int docID) throws IOException {
+ TermVectors termVectors = getTermVectorsReader();
+ if (termVectors != null) {
+ return termVectors.get(docID);
+ }
+ return null;
+ }
+ ;
+
+ /** Get TermVectors from this index, or null if term vectors were not
indexed. */
+ public abstract TermVectors getTermVectorsReader();
Review comment:
This (not returning `TermVectorsReader` here) was done on purpose to
avoid leaking codec API into index
https://github.com/apache/lucene/pull/180#discussion_r650720327, and renaming
the method to `getTermVectors` may make it not consistent with the rest of
reader methods in `CodecReader`. I guess this is a consequence of having this
API at the Index level, in order to get rid of ThreadLocal? Please let me know
if you have other suggestions.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]