org.apache.jackrabbit.core.query.lucene.join
Class Join

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.join.Join
All Implemented Interfaces:
CloseableHits, MultiColumnQueryHits

public class Join
extends Object
implements MultiColumnQueryHits

Join implements the result of a join.


Field Summary
protected  List<ScoreNode[]> buffer
          A buffer for joined score node rows.
protected  Condition condition
          The join condition.
protected  ScoreNode[] emptyInnerHits
          An array of empty inner query hits.
protected  boolean innerJoin
          Whether this is an inner join.
protected  MultiColumnQueryHits outer
          The outer query hits.
protected  int outerScoreNodeIndex
          The score node index of the outer query hits.
protected  Name[] selectorNames
          The selector names.
 
Method Summary
 void close()
          Releases resources held by this hits instance.
static Join create(MultiColumnQueryHits left, MultiColumnQueryHits right, JoinType joinType, JoinConditionImpl condition, org.apache.lucene.index.IndexReader reader, HierarchyResolver resolver, NamespaceMappings nsMappings, HierarchyManager hmgr)
          Creates a new join result.
protected static int getIndex(MultiColumnQueryHits source, Name selectorName)
          Returns the index of the selector with the given selectorName within the given source.
 Name[] getSelectorNames()
          
 int getSize()
          This default implementation always returns -1.
protected static MultiColumnQueryHits getSourceWithName(Name selectorName, MultiColumnQueryHits left, MultiColumnQueryHits right)
           
 ScoreNode[] nextScoreNodes()
          Returns the next score nodes in this QueryHits or null if there are no more score nodes.
 void skip(int n)
          Skips a n score nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outer

protected final MultiColumnQueryHits outer
The outer query hits.


outerScoreNodeIndex

protected final int outerScoreNodeIndex
The score node index of the outer query hits.


innerJoin

protected final boolean innerJoin
Whether this is an inner join.


condition

protected final Condition condition
The join condition.


selectorNames

protected final Name[] selectorNames
The selector names.


emptyInnerHits

protected final ScoreNode[] emptyInnerHits
An array of empty inner query hits.


buffer

protected final List<ScoreNode[]> buffer
A buffer for joined score node rows.

Method Detail

create

public static Join create(MultiColumnQueryHits left,
                          MultiColumnQueryHits right,
                          JoinType joinType,
                          JoinConditionImpl condition,
                          org.apache.lucene.index.IndexReader reader,
                          HierarchyResolver resolver,
                          NamespaceMappings nsMappings,
                          HierarchyManager hmgr)
                   throws IOException
Creates a new join result.

Parameters:
left - the left query hits.
right - the right query hits.
joinType - the join type.
condition - the QOM join condition.
reader - the index reader.
resolver - the hierarchy resolver.
nsMappings - namespace mappings of this index
hmgr - the hierarchy manager of the workspace.
Returns:
the join result.
Throws:
IOException - if an error occurs while executing the join.

nextScoreNodes

public ScoreNode[] nextScoreNodes()
                           throws IOException
Returns the next score nodes in this QueryHits or null if there are no more score nodes.

Specified by:
nextScoreNodes in interface MultiColumnQueryHits
Returns:
the next score nodes in this QueryHits.
Throws:
IOException - if an error occurs while reading from the index.

getSelectorNames

public Name[] getSelectorNames()

Specified by:
getSelectorNames in interface MultiColumnQueryHits
Returns:
the selector names that correspond to the ScoreNodes returned by MultiColumnQueryHits.nextScoreNodes().

close

public void close()
           throws IOException
Releases resources held by this hits instance. Closes outer source and the condition.

Specified by:
close in interface CloseableHits
Throws:
IOException - if an error occurs while releasing resources.

getSize

public int getSize()
This default implementation always returns -1.

Specified by:
getSize in interface CloseableHits
Returns:
always -1.

skip

public void skip(int n)
          throws IOException
Skips a n score nodes. Skips by calling nextScoreNodes() n times. Sub classes may provide a more performance implementation.

Specified by:
skip in interface CloseableHits
Parameters:
n - the number of score nodes to skip.
Throws:
IOException - if an error occurs while skipping.

getSourceWithName

protected static MultiColumnQueryHits getSourceWithName(Name selectorName,
                                                        MultiColumnQueryHits left,
                                                        MultiColumnQueryHits right)

getIndex

protected static int getIndex(MultiColumnQueryHits source,
                              Name selectorName)
Returns the index of the selector with the given selectorName within the given source.

Parameters:
source - a source.
selectorName - a selector name.
Returns:
the index within the source or -1 if the name does not exist in source.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.