ModeShape Distribution 3.2.0.Final

org.modeshape.jcr.query.lucene.basic
Class BasicTupleCollector

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by org.modeshape.jcr.query.lucene.LuceneQueryEngine.TupleCollector
          extended by org.modeshape.jcr.query.lucene.basic.BasicTupleCollector

@NotThreadSafe
public class BasicTupleCollector
extends LuceneQueryEngine.TupleCollector

The BasicLuceneSchema does not store any fields in the indexes, with the exception of the document identifier in which we're storing the key of the node that the document represents. Thus, in order to provide for each document the column values for each tuple, this collector looks up the CachedNode for each tuple using the QueryContext's RepositoryCache and then finds the property value for each required column.

In all cases, only the persisted workspace content appears in the indexes, so every Lucene Query only operates against this persisted content. However, the query results might reflect either only the persisted workspace content or the session's view of the content (which includes both its transient state as well as the persisted workspace content), depending upon whether the QueryContext's NodeCache is actually a WorkspaceCache or a SessionCache.

This class's constructor prepares the information that's ncessary to access the tuple values as fast as possible.


Nested Class Summary
protected static class BasicTupleCollector.LocalNameColumnAssignment
           
protected static class BasicTupleCollector.NameColumnAssignment
           
protected static class BasicTupleCollector.NodeDepthColumnAssignment
           
protected static class BasicTupleCollector.PathColumnAssignment
           
protected static class BasicTupleCollector.PseudoColumnAssignment
           
protected static class BasicTupleCollector.ScoreColumnAssignment
           
 
Constructor Summary
BasicTupleCollector(QueryContext queryContext, QueryResults.Columns columns)
           
 
Method Summary
 boolean acceptsDocsOutOfOrder()
           
 float doCollect(int doc)
           
 List<Object[]> getTuples()
          Get the tuples.
 void setNextReader(org.apache.lucene.index.IndexReader reader, int docBase)
           
 void setScorer(org.apache.lucene.search.Scorer scorer)
           
 
Methods inherited from class org.modeshape.jcr.query.lucene.LuceneQueryEngine.TupleCollector
collect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTupleCollector

public BasicTupleCollector(QueryContext queryContext,
                           QueryResults.Columns columns)
Method Detail

setScorer

public void setScorer(org.apache.lucene.search.Scorer scorer)
Specified by:
setScorer in class org.apache.lucene.search.Collector

setNextReader

public void setNextReader(org.apache.lucene.index.IndexReader reader,
                          int docBase)
Specified by:
setNextReader in class org.apache.lucene.search.Collector

acceptsDocsOutOfOrder

public boolean acceptsDocsOutOfOrder()
Specified by:
acceptsDocsOutOfOrder in class org.apache.lucene.search.Collector

doCollect

public float doCollect(int doc)
                throws IOException
Specified by:
doCollect in class LuceneQueryEngine.TupleCollector
Throws:
IOException

getTuples

public List<Object[]> getTuples()
Description copied from class: LuceneQueryEngine.TupleCollector
Get the tuples.

Specified by:
getTuples in class LuceneQueryEngine.TupleCollector
Returns:
the tuples; never null

ModeShape Distribution 3.2.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.