C# Class Roadkill.Core.Services.SearchService

Provides searching tasks using a Lucene.net search index.
Inheritance: ISearchService
显示文件 Open project: LocalGovDigital/pipeline Class Usage Examples

Public Methods

Method Description
Add ( PageViewModel model ) : void

Adds the specified page to the search index.

CreateIndex ( ) : void

Creates the initial search index based on all pages in the system.

Delete ( PageViewModel model ) : int

Deletes the specified page from the search indexs.

Search ( string searchText ) : IEnumerable

Searches the lucene index with the search text.

Syntax reference: http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Wildcard

SearchService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository, IPluginFactory pluginFactory ) : System
Update ( PageViewModel model ) : void

Updates the Page in the search index, by removing it and re-adding it.

Private Methods

Method Description
EnsureDirectoryExists ( ) : void
GetContentSummary ( PageViewModel model ) : string

Converts the page summary to a lucene Document with the relevant searchable fields.

Method Details

Add() public method

Adds the specified page to the search index.
An error occured with the lucene.net IndexWriter while adding the page to the index.
public Add ( PageViewModel model ) : void
model Roadkill.Core.Mvc.ViewModels.PageViewModel The page to add.
return void

CreateIndex() public method

Creates the initial search index based on all pages in the system.
An error occured with the lucene.net IndexWriter while adding the page to the index.
public CreateIndex ( ) : void
return void

Delete() public method

Deletes the specified page from the search indexs.
An error occured with the lucene.net IndexReader while deleting the page from the index.
public Delete ( PageViewModel model ) : int
model Roadkill.Core.Mvc.ViewModels.PageViewModel The page to remove.
return int

Search() public method

Searches the lucene index with the search text.
Syntax reference: http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Wildcard
An error occured searching the lucene.net index.
public Search ( string searchText ) : IEnumerable
searchText string The text to search with.
return IEnumerable

SearchService() public method

public SearchService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository, IPluginFactory pluginFactory ) : System
settings Roadkill.Core.Configuration.ApplicationSettings
repository IRepository
pluginFactory IPluginFactory
return System

Update() public method

Updates the Page in the search index, by removing it and re-adding it.
An error occured with lucene.net while deleting the page or inserting it back into the index.
public Update ( PageViewModel model ) : void
model Roadkill.Core.Mvc.ViewModels.PageViewModel The page to update
return void