public final class TotalFacetCountsCache extends Object
TotalFacetCounts
per index, taxonomy, and
facet indexing params.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_SIZE
Default size of in memory cache for computed total facet counts.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache.
|
int |
getCacheSize() |
static TotalFacetCountsCache |
getSingleton()
Get the single instance of this cache
|
TotalFacetCounts |
getTotalCounts(IndexReader indexReader,
TaxonomyReader taxonomy,
FacetIndexingParams facetIndexingParams)
Get the total facet counts for a reader/taxonomy pair and facet indexing
parameters.
|
void |
load(File inputFile,
IndexReader indexReader,
TaxonomyReader taxonomy,
FacetIndexingParams facetIndexingParams)
Load
TotalFacetCounts matching input parameters from the provided
outputFile and add them into the cache for the provided indexReader,
taxonomy, and facetIndexingParams. |
void |
setCacheSize(int size)
Set the number of TotalFacetCounts arrays that will remain in memory cache.
|
void |
store(File outputFile,
IndexReader indexReader,
TaxonomyReader taxonomy,
FacetIndexingParams facetIndexingParams)
Store the
TotalFacetCounts matching input parameters into the
provided outputFile, making them available for a later call to
load(File, IndexReader, TaxonomyReader, FacetIndexingParams) . |
public static final int DEFAULT_CACHE_SIZE
public static TotalFacetCountsCache getSingleton()
public TotalFacetCounts getTotalCounts(IndexReader indexReader, TaxonomyReader taxonomy, FacetIndexingParams facetIndexingParams) throws IOException
indexReader
- the documents indextaxonomy
- the taxonomy indexfacetIndexingParams
- facet indexing parametersIOException
public void load(File inputFile, IndexReader indexReader, TaxonomyReader taxonomy, FacetIndexingParams facetIndexingParams) throws IOException
TotalFacetCounts
matching input parameters from the provided
outputFile and add them into the cache for the provided indexReader,
taxonomy, and facetIndexingParams. If a TotalFacetCounts
for these
parameters already exists in the cache, it will be replaced by the loaded
one.inputFile
- file from which to read the dataindexReader
- the documents indextaxonomy
- the taxonomy indexfacetIndexingParams
- the facet indexing parametersIOException
- on errorpublic void store(File outputFile, IndexReader indexReader, TaxonomyReader taxonomy, FacetIndexingParams facetIndexingParams) throws IOException
TotalFacetCounts
matching input parameters into the
provided outputFile, making them available for a later call to
load(File, IndexReader, TaxonomyReader, FacetIndexingParams)
. If
these TotalFacetCounts
are available in the cache, they are used.
But if they are not in the cache, this call will first compute them (which
will also add them to the cache).outputFile
- file to store in.indexReader
- the documents indextaxonomy
- the taxonomy indexfacetIndexingParams
- the facet indexing parametersIOException
- on errorload(File, IndexReader, TaxonomyReader, FacetIndexingParams)
public void clear()
public int getCacheSize()
public void setCacheSize(int size)
If new size is smaller than current size, the cache is appropriately trimmed.
Minimal size is 1, so passing zero or negative size would result in size of 1.
size
- new size to setCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.