org.apache.jackrabbit.core.query.lucene
Class SharedFieldCache

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.SharedFieldCache

public class SharedFieldCache
extends Object

Implements a variant of the lucene class org.apache.lucene.search.FieldCacheImpl. The lucene FieldCache class has some sort of support for custom comparators but it only works on the basis of a field name. There is no further control over the terms to iterate, that's why we use our own implementation.


Nested Class Summary
static class SharedFieldCache.ValueIndex
          Expert: Stores term text values and document ordering data.
 
Field Summary
static SharedFieldCache INSTANCE
          Reference to the single instance of SharedFieldCache.
 
Method Summary
 SharedFieldCache.ValueIndex getValueIndex(org.apache.lucene.index.IndexReader reader, String field, String prefix, org.apache.lucene.search.SortComparatorSource comparator)
          Creates a ValueIndex for a field and a term prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SharedFieldCache INSTANCE
Reference to the single instance of SharedFieldCache.

Method Detail

getValueIndex

public SharedFieldCache.ValueIndex getValueIndex(org.apache.lucene.index.IndexReader reader,
                                                 String field,
                                                 String prefix,
                                                 org.apache.lucene.search.SortComparatorSource comparator)
                                          throws IOException
Creates a ValueIndex for a field and a term prefix. The term prefix acts as the property name for the shared field.

This method is an adapted version of: FieldCacheImpl.getStringIndex()

Parameters:
reader - the IndexReader.
field - name of the shared field.
prefix - the property name, will be used as term prefix.
comparator - the sort comparator instance.
Returns:
a ValueIndex that contains the field values and order information.
Throws:
IOException - if an error occurs while reading from the index.


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