Class LuceneSearchProvider
A search provider implementation for Lucene Search.
Namespace: Mediachase.Search.Providers.Lucene
Assembly: Mediachase.Search.LuceneSearchProvider.dll
Version: 14.26.0Syntax
public class LuceneSearchProvider : SearchProvider
Constructors
LuceneSearchProvider()
Declaration
public LuceneSearchProvider()
Fields
IndexSearcherPool
Declaration
protected static IndexSearcherPool IndexSearcherPool
Field Value
| Type | Description |
|---|---|
| IndexSearcherPool |
IndexWriters
Declaration
protected static Dictionary<LuceneSearchProvider.CoreKey, LuceneIndexWriter> IndexWriters
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<LuceneSearchProvider.CoreKey, LuceneIndexWriter> |
ProviderLock
Declaration
protected static readonly object ProviderLock
Field Value
| Type | Description |
|---|---|
| System.Object |
QueryBuilder
Declaration
protected ISearchQueryBuilder QueryBuilder
Field Value
| Type | Description |
|---|---|
| ISearchQueryBuilder |
Storage
Declaration
protected string Storage
Field Value
| Type | Description |
|---|---|
| System.String |
Properties
AutoCommit
Gets a value indicating whether to [auto commit].
Declaration
public bool AutoCommit { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
AutoCommitCount
Gets the auto commit count.
Declaration
public int AutoCommitCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The auto commit count. |
QueryBuilderType
Gets the class type of the query builder. This class will be used to dynamically convert SearchCriteria to a query that Search Provider can understand.
Declaration
public override string QueryBuilderType { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The type of the query builder. |
Overrides
Examples
// The following type will build a query for the SOLR server "Mediachase.Search.Providers.Solr.SolrSearchQueryBuilder, Mediachase.Search.SolrSearchProvider"
SimulateFaceting
Gets a value indicating whether or not to simulate faceting.
Declaration
public bool SimulateFaceting { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Close(String, String)
Closes the specified provider.
Declaration
public override void Close(string applicationName, string scope)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
Overrides
Commit(String)
Commits changes made to this instance.
Declaration
public override void Commit(string applicationName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
Overrides
ConvertStringToSortable(Decimal)
Converts the string to sortable.
Declaration
protected string ConvertStringToSortable(Decimal input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Decimal | input | The input. |
Returns
| Type | Description |
|---|---|
| System.String |
ConvertStringToSortable(String)
Converts the string to sortable.
Declaration
protected string ConvertStringToSortable(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The input. |
Returns
| Type | Description |
|---|---|
| System.String |
GetSearcher(String, String)
Get index searcher.
Declaration
protected virtual CachedIndexSearcher GetSearcher(string applicationName, string scope)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
Returns
| Type | Description |
|---|---|
| CachedIndexSearcher | Return the searcher. |
GetWriter(String, String)
Get index writer.
Declaration
protected virtual LuceneIndexWriter GetWriter(string applicationName, string scope)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
Returns
| Type | Description |
|---|---|
| LuceneIndexWriter | Return the writer. |
Index(String, String, ISearchDocument)
Adds the document to the index. Depending on the provider, the document will be commited only after commit is called.
Declaration
public override void Index(string applicationName, string scope, ISearchDocument document)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
| ISearchDocument | document | The document. |
Overrides
Initialize(String, NameValueCollection)
Initializes the provider.
Declaration
public override void Initialize(string name, NameValueCollection config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The friendly name of the provider. |
| System.Collections.Specialized.NameValueCollection | config | A collection of the name/value pairs representing the provider specific attributes specified in the configuration for this provider. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | The name of the provider is null. |
| System.ArgumentException | The name of the provider has a length of zero. |
| System.InvalidOperationException | An attempt is made to call System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection) for a provider after the provider has already been initialized. |
Remove(String, String, String, String)
Removes the document by specifying scope (core in SOLR), key (a field that can be used to lookup for a document) and value of the key.
Declaration
public override int Remove(string applicationName, string scope, string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
| System.String | key | The key. |
| System.String | value | The value. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Always returns one. The number of documents removed may not be immediately available. |
Overrides
RemoveAll(String, String)
Removes all documents in the specified scope.
Declaration
public override void RemoveAll(string applicationName, string scope)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| System.String | scope | The scope. |
Overrides
Search(String, ISearchCriteria)
Searches the datasource using the specified criteria. Criteria is parsed by the query builder specified by LuceneSearchProvider.QueryBuilderType.
Declaration
public override ISearchResults Search(string applicationName, ISearchCriteria criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | applicationName | Name of the application. |
| ISearchCriteria | criteria | The criteria. |
Returns
| Type | Description |
|---|---|
| ISearchResults |