org.apache.accumulo.examples.wikisearch.iterator
Class BooleanLogicIterator
java.lang.Object
org.apache.accumulo.examples.wikisearch.iterator.BooleanLogicIterator
- All Implemented Interfaces:
- OptionDescriber, SortedKeyValueIterator<Key,Value>
public class BooleanLogicIterator
- extends Object
- implements SortedKeyValueIterator<Key,Value>, OptionDescriber
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static final org.apache.log4j.Logger log
QUERY_OPTION
public static final String QUERY_OPTION
- See Also:
- Constant Field Values
TERM_CARDINALITIES
public static final String TERM_CARDINALITIES
- See Also:
- Constant Field Values
FIELD_INDEX_QUERY
public static final String FIELD_INDEX_QUERY
- See Also:
- Constant Field Values
FIELD_NAME_PREFIX
public static final String FIELD_NAME_PREFIX
- See Also:
- Constant Field Values
nullText
protected org.apache.hadoop.io.Text nullText
BooleanLogicIterator
public BooleanLogicIterator()
BooleanLogicIterator
public BooleanLogicIterator(BooleanLogicIterator other,
IteratorEnvironment env)
setLogLevel
public static void setLogLevel(org.apache.log4j.Level lev)
setDebug
public void setDebug(org.apache.log4j.Level lev)
deepCopy
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env)
- Specified by:
deepCopy in interface SortedKeyValueIterator<Key,Value>
init
public void init(SortedKeyValueIterator<Key,Value> source,
Map<String,String> options,
IteratorEnvironment env)
throws IOException
- init is responsible for setting up the iterator. It will pull the serialized boolean parse tree from the options mapping and construct the
appropriate sub-iterators
Once initialized, this iterator will automatically seek to the first matching instance. If no top key exists, that means an event matching the boolean
logic did not exist in the partition. Subsequent calls to next will move the iterator and all sub-iterators to the next match.
- Specified by:
init in interface SortedKeyValueIterator<Key,Value>
- Parameters:
source - The underlying SortedkeyValueIterator.options - A Map of options.env - The iterator environment
- Throws:
IOException
transformTreeNode
public BooleanLogicTreeNode transformTreeNode(TreeNode node)
throws org.apache.commons.jexl2.parser.ParseException
- Throws:
org.apache.commons.jexl2.parser.ParseException
collapseBranches
public static void collapseBranches(BooleanLogicTreeNode myroot)
throws Exception
- Throws:
Exception
refactorTree
public BooleanLogicTreeNode refactorTree(BooleanLogicTreeNode myroot)
showDepthFirstTraversal
public static void showDepthFirstTraversal(BooleanLogicTreeNode root)
- Small utility function to print out the depth-first enumeration of the tree. Specify the root or sub root of the tree you wish to view.
- Parameters:
root - The root node of the tree or sub-tree.
showBreadthFirstTraversal
public static void showBreadthFirstTraversal(BooleanLogicTreeNode root)
hasTop
public boolean hasTop()
- Specified by:
hasTop in interface SortedKeyValueIterator<Key,Value>
getTopKey
public Key getTopKey()
- Specified by:
getTopKey in interface SortedKeyValueIterator<Key,Value>
getTopValue
public Value getTopValue()
- Specified by:
getTopValue in interface SortedKeyValueIterator<Key,Value>
next
public 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
describeOptions
public OptionDescriber.IteratorOptions describeOptions()
- Specified by:
describeOptions in interface OptionDescriber
validateOptions
public boolean validateOptions(Map<String,String> options)
- Specified by:
validateOptions in interface OptionDescriber
Copyright © 2012 The Apache Software Foundation. All Rights Reserved.