Class Join
- java.lang.Object
-
- org.apache.jackrabbit.core.query.lucene.join.Join
-
- All Implemented Interfaces:
CloseableHits,MultiColumnQueryHits
public class Join extends Object implements MultiColumnQueryHits
Joinimplements the result of a join.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ScoreNode[]>bufferA buffer for joined score node rows.protected ConditionconditionThe join condition.protected ScoreNode[]emptyInnerHitsAn array of empty inner query hits.protected booleaninnerJoinWhether this is an inner join.protected MultiColumnQueryHitsouterThe outer query hits.protected intouterScoreNodeIndexThe score node index of the outer query hits.protected Name[]selectorNamesThe selector names.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Releases resources held by this hits instance.static Joincreate(MultiColumnQueryHits left, MultiColumnQueryHits right, JoinType joinType, JoinConditionImpl condition, IndexReader reader, HierarchyResolver resolver, NamespaceMappings nsMappings, HierarchyManager hmgr)Creates a new join result.protected static intgetIndex(MultiColumnQueryHits source, Name selectorName)Returns the index of the selector with the givenselectorNamewithin the givensource.Name[]getSelectorNames()intgetSize()This default implementation always returns-1.protected static MultiColumnQueryHitsgetSourceWithName(Name selectorName, MultiColumnQueryHits left, MultiColumnQueryHits right)ScoreNode[]nextScoreNodes()Returns the next score nodes in this QueryHits ornullif there are no more score nodes.voidskip(int n)Skips anscore nodes.
-
-
-
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.
-
-
Method Detail
-
create
public static Join create(MultiColumnQueryHits left, MultiColumnQueryHits right, JoinType joinType, JoinConditionImpl condition, 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 indexhmgr- 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 ornullif there are no more score nodes.- Specified by:
nextScoreNodesin interfaceMultiColumnQueryHits- 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:
getSelectorNamesin interfaceMultiColumnQueryHits- Returns:
- the selector names that correspond to the
ScoreNodes returned byMultiColumnQueryHits.nextScoreNodes().
-
close
public void close() throws IOException- Specified by:
closein interfaceCloseableHits- Throws:
IOException- if an error occurs while releasing resources.
-
getSize
public int getSize()
This default implementation always returns-1.- Specified by:
getSizein interfaceCloseableHits- Returns:
- always
-1.
-
skip
public void skip(int n) throws IOExceptionSkips anscore nodes. Skips by callingnextScoreNodes()ntimes. Sub classes may provide a more performance implementation.- Specified by:
skipin interfaceCloseableHits- 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 givenselectorNamewithin the givensource.- Parameters:
source- a source.selectorName- a selector name.- Returns:
- the index within the source or
-1if the name does not exist insource.
-
-