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:
Britta Weber 2013-07-15 14:15:51 +02:00
parent 3004a2a696
commit 7098073a66
1 changed files with 3 additions and 2 deletions

View File

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