Class IndexSearcherPool
Provides a pool of IndesSearcher instances.
Inheritance
Inherited Members
Namespace: Mediachase.Search.Providers.Lucene
Assembly: Mediachase.Search.LuceneSearchProvider.dll
Version: 12.17.2Syntax
public class IndexSearcherPool
Remarks
Creating a new IndexSearcher is expensive. This class provides a safe way to re-use IndexSearcher instances by using a pool and handing out instances in a thread-safe manner.
Constructors
IndexSearcherPool(TimeSpan)
Initializes a new instance of the IndexSearcherPool class.
Declaration
public IndexSearcherPool(TimeSpan cacheTimeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | cacheTimeout | The cache timeout which specifies how long an IndexSearcher will be re-usable. |
Methods
Clear()
Clears all pooled IndexSearcher instances.
Declaration
public void Clear()
Remarks
Any IndexSearchers that are in the pool will be disposed and removed from the pool.
Get(Directory)
Gets an IndexSearcher instance that uses the specified directory path.
Declaration
public CachedIndexSearcher Get(Directory storeDirectory)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Store.Directory | storeDirectory | The cloud store directory path of the search index. |
Returns
Type | Description |
---|---|
CachedIndexSearcher | A cachedIndexSearcher, which is an IndexSearcher with a few additional properties to support caching. |
Get(String)
Gets an IndexSearcher instance that uses the specified directory path.
Declaration
public CachedIndexSearcher Get(string dirPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | dirPath | The directory path of the search index. |
Returns
Type | Description |
---|---|
CachedIndexSearcher | A cachedIndexSearcher, which is an IndexSearcher with a few additional properties to support caching. |
Put(CachedIndexSearcher)
Puts the specified IndexSearcher into the pool.
Declaration
public void Put(CachedIndexSearcher searcher)
Parameters
Type | Name | Description |
---|---|---|
CachedIndexSearcher | searcher | The index searcher. |
Remarks
If the searcher has already expired when calling this method, it will be disposed and not put into the pool.