apache/lucene.net — pull request #3 by NeNSha (2012-04-25 08:49:26+00:00)
Title: F# Application example

I don't know if that could be useful or not but here is Lucene.NET usage example on F#

``` fsharp
let LuceneWrite() =
let filename = AppDomain.CurrentDomain.BaseDirectory + "LuceneIndex"
printfn "Lucene index: %s" filename
use directory = FSDirectory.Open(new System.IO.DirectoryInfo(filename));
let version = new Lucene.Net.Util.Version()
let analyzer = new StandardAnalyzer(version)
use writer = new IndexWriter(directory, analyzer, IndexWriter.MaxFieldLength.UNLIMITED)
let indexReader = IndexReader.Open(directory, false)
AddTextToIndex 0 "hello" writer
writer.Optimize()
writer.Commit()
//Sercher example
use searcher = new IndexSearcher(directory, false)
let parser = new QueryParser(version, "postBody", analyzer)
Search "hello" searcher parser indexReader
```