|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.facet.complements.TotalFacetCountsCache
public final class TotalFacetCountsCache
Manage an LRU cache for TotalFacetCounts
per index, taxonomy, and
facet indexing params.
Field Summary | |
---|---|
static int |
DEFAULT_CACHE_SIZE
Default size of in memory cache for computed total facet counts. |
Method Summary | |
---|---|
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) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CACHE_SIZE
Method Detail |
---|
public static TotalFacetCountsCache getSingleton()
public TotalFacetCounts getTotalCounts(IndexReader indexReader, TaxonomyReader taxonomy, FacetIndexingParams facetIndexingParams) throws IOException
indexReader
- the documents indextaxonomy
- the taxonomy indexfacetIndexingParams
- facet indexing parameters
IOException
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 parameters
IOException
- 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 parameters
IOException
- 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 set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |