You will create a new index class and register one field that will use a specific analyzer, the FrenchAnalyzer
. This index will perform search over the Cities
collections on the Name
field. To query this index you will use a .Search()
method and specify a Where
closure.
Start Visual Studio and open the
RavenDB_CH05
solution.Use the NuGet Package Manager to add a reference to the Lucen.Net Contrib package:
Add a new class to the project, name it
Cities_CustomAnalyzer
that inherits fromAbstractIndexCreationTask
class:Add a default constructor, and then add the
Map
function within the class constructor using the following code snippet:Under the
Map
function, addAnalyzer
field's registration to the class constructor using the following code snippet:Add the following code snippet to the
Main()
method in theProgram
class:Save all the files.
Open the
RavenDB_Ch05
output folder and copyLucene.Net.Contrib.Analyzers.dll
to the\Analyzers
folder under the...