From 7c4c289b2e7662aa4e0b4832e41a9b862637fcb7 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Tue, 21 Feb 2012 10:12:37 +0000 Subject: [PATCH] Fix another bug in ParallelAtomicReader: Term vectors method should return null if no term vectors are there. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1291688 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/lucene/index/ParallelAtomicReader.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java b/lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java index eccb6cad701..4b88c2d6aa8 100644 --- a/lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/ParallelAtomicReader.java @@ -237,11 +237,14 @@ public final class ParallelAtomicReader extends AtomicReader { @Override public Fields getTermVectors(int docID) throws IOException { ensureOpen(); - ParallelFields fields = new ParallelFields(); + ParallelFields fields = null; for (Map.Entry ent : fieldToReader.entrySet()) { String fieldName = ent.getKey(); Terms vector = ent.getValue().getTermVector(docID, fieldName); if (vector != null) { + if (fields == null) { + fields = new ParallelFields(); + } fields.addField(fieldName, vector); } }