com.atlassian.greenhopper.service.lucene
Class LeftJoinQuery

java.lang.Object
  extended by org.apache.lucene.search.Query
      extended by com.atlassian.greenhopper.service.lucene.AbstractBitsetQuery
          extended by com.atlassian.greenhopper.service.lucene.LeftJoinQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class LeftJoinQuery
extends AbstractBitsetQuery

TODO FIXUP this doco A query that performs a join between two indexes (left and right). This query can be used on the left index, and it selects documents in the left that match documents on the right. Documents on the left/right are "matched" using a fields with common values.

Specifically, this query will match documents in leftIndex, where leftdoc.leftField == rightdoc.rightField, and rightdoc is in rightDocIds;

This implementation doesn't do anything smart wrt to scoring at the moment.

Performance will be expected to be O(l+r); l is the number of Terms that match on the left, r is the number of terms that match on the right.

In the case where there is a 1-1 between left and right, best-case becomes O(1)

Author:
Matt Quail
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.atlassian.greenhopper.service.lucene.AbstractBitsetQuery
score
 
Constructor Summary
LeftJoinQuery(java.lang.String leftField, org.apache.lucene.index.IndexReader rightReader, java.lang.String rightField, java.util.BitSet rightDocIds)
           
LeftJoinQuery(java.lang.String leftField, RightJoinEnum rightEnum)
           
 
Method Summary
protected  java.util.BitSet computeBitset(org.apache.lucene.index.IndexReader reader)
           
protected  java.lang.String getFilterExplanation()
           
static BitSetRightJoinEnum makeBitsetRightJoin(java.util.BitSet rightDocIds, org.apache.lucene.index.IndexReader rightReader, java.lang.String rightField)
           
static DocumentRightJoinEnum makeDocumentRightEnum(java.util.BitSet rightDocIds, org.apache.lucene.index.IndexReader rightReader, java.lang.String rightField)
           
static RightJoinEnum makeRightEnum(java.util.BitSet rightDocIds, org.apache.lucene.index.IndexReader rightReader, java.lang.String rightField)
           
 java.lang.String toString(java.lang.String field)
           
 
Methods inherited from class com.atlassian.greenhopper.service.lucene.AbstractBitsetQuery
getSimilarity, rewrite
 
Methods inherited from class org.apache.lucene.search.Query
clone, combine, createWeight, equals, extractTerms, getBoost, hashCode, mergeBooleanQueries, setBoost, toString, weight
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LeftJoinQuery

public LeftJoinQuery(java.lang.String leftField,
                     org.apache.lucene.index.IndexReader rightReader,
                     java.lang.String rightField,
                     java.util.BitSet rightDocIds)
Parameters:
leftField - the match field on the left
rightReader - the Reader for the left index
rightField - the match field on the right
rightDocIds - the documents on the right to consider

LeftJoinQuery

public LeftJoinQuery(java.lang.String leftField,
                     RightJoinEnum rightEnum)
Method Detail

makeRightEnum

public static RightJoinEnum makeRightEnum(java.util.BitSet rightDocIds,
                                          org.apache.lucene.index.IndexReader rightReader,
                                          java.lang.String rightField)

makeBitsetRightJoin

public static BitSetRightJoinEnum makeBitsetRightJoin(java.util.BitSet rightDocIds,
                                                      org.apache.lucene.index.IndexReader rightReader,
                                                      java.lang.String rightField)

makeDocumentRightEnum

public static DocumentRightJoinEnum makeDocumentRightEnum(java.util.BitSet rightDocIds,
                                                          org.apache.lucene.index.IndexReader rightReader,
                                                          java.lang.String rightField)

computeBitset

protected java.util.BitSet computeBitset(org.apache.lucene.index.IndexReader reader)
                                  throws java.io.IOException
Specified by:
computeBitset in class AbstractBitsetQuery
Throws:
java.io.IOException

getFilterExplanation

protected java.lang.String getFilterExplanation()
Specified by:
getFilterExplanation in class AbstractBitsetQuery

toString

public java.lang.String toString(java.lang.String field)
Specified by:
toString in class org.apache.lucene.search.Query


Copyright © 2007-2014 Atlassian. All Rights Reserved.