Class 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.
    • 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)
                                                  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.
        Returns:
        a ValueIndex that contains the field values and order information.
        Throws:
        IOException - if an error occurs while reading from the index.