step 1 - create a new console application
Then extract the Lucene.Net.dll from the Apache-Lucene.Net-2.9.2-incubating.bin.zip file into your lib folder.
You'll notice lots of other bits in this zip file. Especially of interest to you later might be the stuff in the contrib folder. I might get to that in a later tutorial, but for now lets keep it simple.
step 2 - add a reference to the lucene.net.dll
Your references should look like this

step 3 - create a document
Ok the next step is to create a simple Document with the appropriate fields which you'll want to search on. In our case we're going to create 3 cars. a Ford Fiesta, a Ford Focus and a Vauxhall Astra.
03 |
using Lucene.Net.Analysis;
|
04 |
using Lucene.Net.Analysis.Standard;
|
05 |
using Lucene.Net.Documents;
|
06 |
using Lucene.Net.Index;
|
07 |
using Lucene.Net.Store;
|
08 |
using Directory = Lucene.Net.Store.Directory;
|
09 |
using Version = Lucene.Net.Util.Version;
|
11 |
namespace LuceneNet.App
|
15 |
static void Main(string[] args)
|
17 |
var fordFiesta = new Document();
|
18 |
fordFiesta.Add(new Field("Id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED));
|
19 |
fordFiesta.Add(new Field("Make", "Ford", Field.Store.YES, Field.Index.ANALYZED));
|
20 |
fordFiesta.Add(new Field("Model", "Fiesta", Field.Store.YES, Field.Index.ANALYZED));
|
22 |
var fordFocus = new Document();
|
23 |
fordFocus.Add(new Field("Id", "2", Field.Store.YES, Field.Index.NOT_ANALYZED));
|
24 |
fordFocus.Add(new Field("Make", "Ford", Field.Store.YES, Field.Index.ANALYZED));
|
25 |
fordFocus.Add(new Field("Model", "Focus", Field.Store.YES, Field.Index.ANALYZED));
|
27 |
var vauxhallAstra = new Document();
|
28 |
vauxhallAstra.Add(new Field("Id", "3", Field.Store.YES, Field.Index.NOT_ANALYZED));
|
29 |
vauxhallAstra.Add(new Field("Make", "Vauxhall", Field.Store.YES, Field.Index.ANALYZED));
|
30 |
vauxhallAstra.Add(new Field("Model", "Astra", Field.Store.YES, Field.Index.ANALYZED));
|
34 |
Directory directory = FSDirectory.Open(new DirectoryInfo(Environment.CurrentDirectory + "\\LuceneIndex"));
|
35 |
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);
|
38 |
var writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
|
39 |
writer.AddDocument(fordFiesta);
|
40 |
writer.AddDocument(fordFocus);
|
41 |
writer.AddDocument(vauxhallAstra);
|