Interface ISearchService
Defines the contract for a search service implementation using Lucene.Net. Provides full-text search and index management capabilities.
Namespace: DataWeb.Search.Lucene
Assembly: DataWeb.Search.Lucene.dll
Syntax
public interface ISearchService
Properties
Name
Gets the unique name that identifies this search service provider.
Declaration
string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
AddOrUpdateEntries(string, IEnumerable<AddEntry>)
Adds or updates entries in the index. Existing entries with the same Id and Culture are removed first.
Declaration
void AddOrUpdateEntries(string indexName, IEnumerable<AddEntry> entries)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index. |
| IEnumerable<AddEntry> | entries | The entries to add or update. |
Clear(string)
Clears all entries from the specified index.
Declaration
void Clear(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index to clear. |
GetDirectory(string)
Gets the Lucene index directory for the specified index name. Creates the directory if it does not exist.
Declaration
FSDirectory GetDirectory(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index. Must not be null or empty. |
Returns
| Type | Description |
|---|---|
| FSDirectory | An Lucene.Net.Store.FSDirectory instance for the index. |
IndexExists(string)
Checks whether a Lucene index exists for the specified index name.
Declaration
bool IndexExists(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveEntries(string, IEnumerable<RemoveEntry>)
Removes entries from the index by Id and Culture.
Declaration
void RemoveEntries(string indexName, IEnumerable<RemoveEntry> entries)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index. |
| IEnumerable<RemoveEntry> | entries | The entries to remove, identified by Id and Culture. |
Search(string, SearchFilter, bool)
Searches the index for entries matching the specified filter criteria. Supports both simple wildcard search and advanced Lucene query syntax.
Declaration
IEnumerable<SearchEntry> Search(string indexName, SearchFilter filter, bool isAdvancedSyntax = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index to search. |
| SearchFilter | filter | The search filter with query and optional criteria. |
| bool | isAdvancedSyntax | If |
Returns
| Type | Description |
|---|---|
| IEnumerable<SearchEntry> | A collection of SearchEntry results matching the criteria. |