org.apache.lucene.facet.search
Class OrdinalsCache

java.lang.Object
  extended by org.apache.lucene.facet.search.OrdinalsCache

public class OrdinalsCache
extends Object

A per-segment cache of documents' category ordinals. Every OrdinalsCache.CachedOrds holds the ordinals in a raw int[], and therefore consumes as much RAM as the total number of ordinals found in the segment.

NOTE: every OrdinalsCache.CachedOrds is limited to 2.1B total ordinals. If that is a limitation for you then consider limiting the segment size to less documents, or use an alternative cache which pages through the category ordinals.

NOTE: when using this cache, it is advised to use a DocValuesFormat that does not cache the data in memory, at least for the category lists fields, or otherwise you'll be doing double-caching.


Nested Class Summary
static class OrdinalsCache.CachedOrds
          Holds the cached ordinals in two paralel int[] arrays.
 
Constructor Summary
OrdinalsCache()
           
 
Method Summary
static OrdinalsCache.CachedOrds getCachedOrds(AtomicReaderContext context, CategoryListParams clp)
          Returns the OrdinalsCache.CachedOrds relevant to the given AtomicReaderContext, or null if there is no BinaryDocValues in this reader for the requested CategoryListParams.field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrdinalsCache

public OrdinalsCache()
Method Detail

getCachedOrds

public static OrdinalsCache.CachedOrds getCachedOrds(AtomicReaderContext context,
                                                     CategoryListParams clp)
                                              throws IOException
Returns the OrdinalsCache.CachedOrds relevant to the given AtomicReaderContext, or null if there is no BinaryDocValues in this reader for the requested CategoryListParams.field.

Throws:
IOException


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.