C# Class Lucene.Net.Search.SparseFacetedSearcher

Based on SimpleFacetedSearch. Uses DocID lists instead on bitmaps. Efficient memory usage for high cardinality sparsely populated facets.

Suitable for high cardinality, sparsely populated facets. i.e. There are a large number of facet values and each facet value is hit in a small percentage of documents. Especially if there are also a large number of documents. SimpleFacetedSearch holds a bitmap for each value representing whether that value is a hit is each document (approx 122KB per 1M documents per facet value). So this is an O(N*M) problem. The memory requirement can grow very quickly.

SparseFacetedSearcher records the DocID (Int32) for each value hit (memory cost = values * hits * 4). SimpleFacetedSearch record a bit for evey document per value (memory cost = values * documents / 8). So if the average number of hits for each value is less than 1/32 or 3.125% then Sparse is more memory efficient.

There are also some enumerable methods than mean there is much less pressure on the GC. Plus some bug fixes.

Show file Open project: Artesian/SparseFacetedSearch Class Usage Examples

Public Properties

Property Type Description
MAX_FACETS int

Public Methods

Method Description
Count ( Query query = null, int maxDocPerGroup = DefaultMaxDocPerGroup ) : FacetCountResult
Search ( Query query = null, int maxDocPerGroup = DefaultMaxDocPerGroup ) : FacetSearchResult
SparseFacetedSearcher ( IndexReader reader ) : System

Private Methods

Method Description
SearchInternal ( Query query = null, int maxDocPerGroup = DefaultMaxDocPerGroup ) : IEnumerable

Method Details

Count() public method

public Count ( Query query = null, int maxDocPerGroup = DefaultMaxDocPerGroup ) : FacetCountResult
query Query
maxDocPerGroup int
return FacetCountResult

Search() public method

public Search ( Query query = null, int maxDocPerGroup = DefaultMaxDocPerGroup ) : FacetSearchResult
query Query
maxDocPerGroup int
return FacetSearchResult

SparseFacetedSearcher() public method

public SparseFacetedSearcher ( IndexReader reader ) : System
reader Lucene.Net.Index.IndexReader
return System

Property Details

MAX_FACETS public static property

public static int MAX_FACETS
return int