DataWeb
Search Results for

    Show / Hide Table of Contents

    Class SearchService

    Lucene.Net implementation of ISearchService. Provides full-text search capabilities using Lucene.Net indexes stored on the file system.

    Inheritance
    object
    SearchService
    Implements
    ISearchService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Search.Lucene
    Assembly: DataWeb.Search.Lucene.dll
    Syntax
    public class SearchService : ISearchService

    Constructors

    SearchService(IEnvironmentService)

    Lucene.Net implementation of ISearchService. Provides full-text search capabilities using Lucene.Net indexes stored on the file system.

    Declaration
    public SearchService(IEnvironmentService environmentService)
    Parameters
    Type Name Description
    IEnvironmentService environmentService

    Properties

    Name

    Gets the unique name that identifies this search service provider.

    Declaration
    public 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
    public void AddOrUpdateEntries(string indexName, IEnumerable<AddEntry> entries)
    Parameters
    Type Name Description
    string indexName

    The name of the index. Must not be null or empty.

    IEnumerable<AddEntry> entries

    The entries to add or update. Must not be null.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    ArgumentNullException

    Thrown when entries is null.

    Clear(string)

    Clears all entries from the specified index.

    Declaration
    public void Clear(string indexName)
    Parameters
    Type Name Description
    string indexName

    The name of the index to clear. Must not be null or empty.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    GetDirectory(string)

    Gets the Lucene index directory for the specified index name. Creates the directory if it does not exist.

    Declaration
    public 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.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    IndexExists(string)

    Checks whether a Lucene index exists for the specified index name.

    Declaration
    public bool IndexExists(string indexName)
    Parameters
    Type Name Description
    string indexName

    The name of the index. Must not be null or empty.

    Returns
    Type Description
    bool

    true if the index exists; otherwise false.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    RemoveEntries(string, IEnumerable<RemoveEntry>)

    Removes entries from the index by Id and Culture.

    Declaration
    public void RemoveEntries(string indexName, IEnumerable<RemoveEntry> entries)
    Parameters
    Type Name Description
    string indexName

    The name of the index. Must not be null or empty.

    IEnumerable<RemoveEntry> entries

    The entries to remove, identified by Id and Culture. Must not be null.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    ArgumentNullException

    Thrown when entries is null.

    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
    public IEnumerable<SearchEntry> Search(string indexName, SearchFilter filter, bool isAdvancedSyntax = false)
    Parameters
    Type Name Description
    string indexName

    The name of the index to search. Must not be null or empty.

    SearchFilter filter

    The search filter with query and optional criteria. Must not be null.

    bool isAdvancedSyntax

    If false, the query is treated as simple text with wildcards added. If true, the query is parsed as Lucene syntax.

    Returns
    Type Description
    IEnumerable<SearchEntry>

    A list of SearchEntry results matching the criteria, or an empty list if no results or index does not exist.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when indexName is null or empty.

    ArgumentNullException

    Thrown when filter is null.

    Implements

    ISearchService
    In this article
    Back to top Generated by DocFX