org.apache.accumulo.examples.wikisearch.iterator
Class OrIterator

java.lang.Object
  extended by org.apache.accumulo.examples.wikisearch.iterator.OrIterator
All Implemented Interfaces:
SortedKeyValueIterator<Key,Value>

public class OrIterator
extends Object
implements SortedKeyValueIterator<Key,Value>

An iterator that handles "OR" query constructs on the server side. This code has been adapted/merged from Heap and Multi Iterators.


Nested Class Summary
protected static class OrIterator.TermSource
           
 
Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
OrIterator()
           
 
Method Summary
 void addTerm(SortedKeyValueIterator<Key,Value> source, org.apache.hadoop.io.Text term, IteratorEnvironment env)
           
 void addTerm(SortedKeyValueIterator<Key,Value> source, org.apache.hadoop.io.Text dataLocation, org.apache.hadoop.io.Text term, IteratorEnvironment env)
           
protected  Key buildTopKey(OrIterator.TermSource TS)
          Construct the topKey given the current TermSource
 SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env)
           
protected  org.apache.hadoop.io.Text getDataLocation(Key key)
          Returns the given key's dataLocation
protected  org.apache.hadoop.io.Text getDocID(Key key)
          Returns the given key's DocID
protected  org.apache.hadoop.io.Text getPartition(Key key)
          Returns the given key's row
protected  org.apache.hadoop.io.Text getTerm(Key key)
          Returns the given key's term
 Key getTopKey()
           
 Value getTopValue()
           
protected static String getUID(Key key)
          Returns the given key's UID
 boolean hasTop()
           
 void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env)
           
 boolean jump(Key jumpKey)
           
 void next()
           
 void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Constructor Detail

OrIterator

public OrIterator()
Method Detail

getPartition

protected org.apache.hadoop.io.Text getPartition(Key key)
Returns the given key's row

Parameters:
key -
Returns:
The given key's row

getDataLocation

protected org.apache.hadoop.io.Text getDataLocation(Key key)
Returns the given key's dataLocation

Parameters:
key -
Returns:
The given key's dataLocation

getTerm

protected org.apache.hadoop.io.Text getTerm(Key key)
Returns the given key's term

Parameters:
key -
Returns:
The given key's term

getDocID

protected org.apache.hadoop.io.Text getDocID(Key key)
Returns the given key's DocID

Parameters:
key -
Returns:
The given key's DocID

getUID

protected static String getUID(Key key)
Returns the given key's UID

Parameters:
key -
Returns:
The given key's UID

deepCopy

public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env)
Specified by:
deepCopy in interface SortedKeyValueIterator<Key,Value>

addTerm

public void addTerm(SortedKeyValueIterator<Key,Value> source,
                    org.apache.hadoop.io.Text term,
                    IteratorEnvironment env)

addTerm

public void addTerm(SortedKeyValueIterator<Key,Value> source,
                    org.apache.hadoop.io.Text dataLocation,
                    org.apache.hadoop.io.Text term,
                    IteratorEnvironment env)

buildTopKey

protected Key buildTopKey(OrIterator.TermSource TS)
Construct the topKey given the current TermSource

Parameters:
TS -
Returns:
The top Key for a given TermSource

next

public final void next()
                throws IOException
Specified by:
next in interface SortedKeyValueIterator<Key,Value>
Throws:
IOException

seek

public void seek(Range range,
                 Collection<ByteSequence> columnFamilies,
                 boolean inclusive)
          throws IOException
Specified by:
seek in interface SortedKeyValueIterator<Key,Value>
Throws:
IOException

getTopKey

public final Key getTopKey()
Specified by:
getTopKey in interface SortedKeyValueIterator<Key,Value>

getTopValue

public final Value getTopValue()
Specified by:
getTopValue in interface SortedKeyValueIterator<Key,Value>

hasTop

public final boolean hasTop()
Specified by:
hasTop in interface SortedKeyValueIterator<Key,Value>

init

public void init(SortedKeyValueIterator<Key,Value> source,
                 Map<String,String> options,
                 IteratorEnvironment env)
          throws IOException
Specified by:
init in interface SortedKeyValueIterator<Key,Value>
Throws:
IOException

jump

public boolean jump(Key jumpKey)
             throws IOException
Throws:
IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.