fix term vector api retrieved wrong doc
The previous loading of term vectors from the top level reader did not use the correct docId. The docId in Versions.DocIdAndVersion is relative to the segment reader in Versions.DocIdAndVersion and not to the top level reader. Consequently the term vectors for the wrong document were returned if the document was not on the first segment of the shard.
This commit is contained in:
parent
3004a2a696
commit
7098073a66
|
@ -108,8 +108,9 @@ public class TransportSingleShardTermVectorAction extends TransportShardSingleOp
|
|||
try {
|
||||
Fields topLevelFields = MultiFields.getFields(topLevelReader);
|
||||
Versions.DocIdAndVersion docIdAndVersion = Versions.loadDocIdAndVersion(topLevelReader, uidTerm);
|
||||
if(docIdAndVersion!=null) {
|
||||
termVectorResponse.setFields(topLevelReader.getTermVectors(docIdAndVersion.docId), request.selectedFields(),
|
||||
|
||||
if (docIdAndVersion != null) {
|
||||
termVectorResponse.setFields(docIdAndVersion.context.reader().getTermVectors(docIdAndVersion.docId), request.selectedFields(),
|
||||
request.getFlags(), topLevelFields);
|
||||
termVectorResponse.setDocVersion(docIdAndVersion.version);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue