Fixed BLUR-195
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/ab5f4ab0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ab5f4ab0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ab5f4ab0 Branch: refs/heads/0.2.0-newtypesystem Commit: ab5f4ab095f9a02af532e69034d384f777ffa313 Parents: 9991a8b Author: Aaron McCurry <[email protected]> Authored: Tue Aug 6 15:16:58 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Tue Aug 6 15:16:58 2013 -0400 ---------------------------------------------------------------------- .../java/org/apache/blur/manager/writer/IndexImporter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ab5f4ab0/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java b/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java index 8c31d6b..d1990c3 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java +++ b/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java @@ -175,6 +175,7 @@ public class IndexImporter extends TimerTask implements Closeable { BlurPartitioner blurPartitioner = new BlurPartitioner(); Text key = new Text(); int numberOfShards = _shardContext.getTableContext().getDescriptor().getShardCount(); + int shardId = BlurUtil.getShardIndex(shard); for (AtomicReaderContext context : leaves) { AtomicReader atomicReader = context.reader(); Fields fields = atomicReader.fields(); @@ -183,16 +184,13 @@ public class IndexImporter extends TimerTask implements Closeable { TermsEnum termsEnum = terms.iterator(null); BytesRef ref = null; while ((ref = termsEnum.next()) != null) { - byte[] rowIdInBytes = ref.bytes; - key.set(rowIdInBytes, 0, rowIdInBytes.length); + key.set(ref.bytes, ref.offset, ref.length); int partition = blurPartitioner.getPartition(key, null, numberOfShards); - int shardId = BlurUtil.getShardIndex(shard); if (shardId != partition) { return false; } if (emitDeletes) { - Term term = new Term(BlurConstants.ROW_ID, BytesRef.deepCopyOf(ref)); - indexWriter.deleteDocuments(term); + indexWriter.deleteDocuments(new Term(BlurConstants.ROW_ID, BytesRef.deepCopyOf(ref))); } } }
