ACCUMULO-665: merge to 1.4 branch git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/1.4@1356403 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/commit/86aeddab Tree: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/tree/86aeddab Diff: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/diff/86aeddab Branch: refs/heads/1.4.5-SNAPSHOT Commit: 86aeddab6414ea4876b39bdde5d229ce1031d3a3 Parents: 5c9f45a Author: Eric C. Newton <e...@apache.org> Authored: Mon Jul 2 18:53:15 2012 +0000 Committer: Eric C. Newton <e...@apache.org> Committed: Mon Jul 2 18:53:15 2012 +0000 ---------------------------------------------------------------------- .../examples/wikisearch/iterator/AndIterator.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/blob/86aeddab/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java ---------------------------------------------------------------------- diff --git a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java index 5ace7c8..b469625 100644 --- a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java +++ b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/AndIterator.java @@ -17,9 +17,11 @@ package org.apache.accumulo.examples.wikisearch.iterator; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Map; +import org.apache.accumulo.core.data.ArrayByteSequence; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.PartialKey; @@ -86,7 +88,8 @@ public class AndIterator implements SortedKeyValueIterator<Key,Value> { } /* - * | Row | Column Family | Column Qualifier | Value | {RowID} | {dataLocation} | {term}\0{dataType}\0{UID} | Empty + * | Row | Column Family | Column Qualifier | Value + * | {RowID} | {dataLocation} | {term}\0{dataType}\0{UID} | Empty */ protected Text getPartition(Key key) { return key.getRow(); @@ -778,21 +781,24 @@ public class AndIterator implements SortedKeyValueIterator<Key,Value> { // seek each of the sources to the right column family within the row given by key for (int i = 0; i < sourcesCount; i++) { Key sourceKey; + Text dataLocation = (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation; + Collection<ByteSequence> columnFamilies = new ArrayList<ByteSequence>(); + columnFamilies.add(new ArrayByteSequence(dataLocation.getBytes(), 0, dataLocation.getLength())); if (range.getStartKey() != null) { // Build a key with the DocID if one is given - if (range.getStartKey().getColumnFamily() != null) { - sourceKey = buildKey(getPartition(range.getStartKey()), (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation, + if (range.getStartKey().getColumnFamily() != null) { + sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, (sources[i].term == null) ? nullText : new Text(sources[i].term + "\0" + range.getStartKey().getColumnFamily())); } // Build a key with just the term. else { - sourceKey = buildKey(getPartition(range.getStartKey()), (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation, + sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, (sources[i].term == null) ? nullText : sources[i].term); } if (!range.isStartKeyInclusive()) sourceKey = sourceKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL); - sources[i].iter.seek(new Range(sourceKey, true, null, false), seekColumnFamilies, inclusive); + sources[i].iter.seek(new Range(sourceKey, true, null, false), columnFamilies, inclusive); } else { - sources[i].iter.seek(range, seekColumnFamilies, inclusive); + sources[i].iter.seek(range, columnFamilies, inclusive); } }