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
Join
implements the result of a join.
-
-
Field Summary
Fields Modifier and Type Field Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Releases resources held by this hits instance.static Join
create(MultiColumnQueryHits left, MultiColumnQueryHits right, JoinType joinType, JoinConditionImpl condition, 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 givenselectorName
within the givensource
.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 ornull
if there are no more score nodes.void
skip(int n)
Skips an
score 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 ornull
if there are no more score nodes.- Specified by:
nextScoreNodes
in 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:
getSelectorNames
in interfaceMultiColumnQueryHits
- Returns:
- the selector names that correspond to the
ScoreNode
s returned byMultiColumnQueryHits.nextScoreNodes()
.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceCloseableHits
- Throws:
IOException
- if an error occurs while releasing resources.
-
getSize
public int getSize()
This default implementation always returns-1
.- Specified by:
getSize
in interfaceCloseableHits
- Returns:
- always
-1
.
-
skip
public void skip(int n) throws IOException
Skips an
score nodes. Skips by callingnextScoreNodes()
n
times. Sub classes may provide a more performance implementation.- Specified by:
skip
in 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 givenselectorName
within the givensource
.- Parameters:
source
- a source.selectorName
- a selector name.- Returns:
- the index within the source or
-1
if the name does not exist insource
.
-
-