I play with Lucene.net to try to get an idea of how to implement it in my application.
I have the following code
.....
var doc1 = new Document();
var doc2 = new Document();
doc1.Add(new Field("id", "doc1", Field.Store.YES, Field.Index.ANALYZED));
doc1.Add(new Field("content", "This is my first document", Field.Store.YES, Field.Index.ANALYZED));
doc2.Add(new Field("id", "doc2", Field.Store.YES, Field.Index.ANALYZED));
doc2.Add(new Field("content", "The big red fox jumped", Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc1);
writer.AddDocument(doc2);
writer.Optimize();
writer.Close();
var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "content", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
var query = parser.Parse("big abcdefg test1234");
var searcher = new IndexSearcher(indexDirectory, true);
var hits = searcher.Search(query);
Assert.AreEqual(1, hits.Length());
var document = hits.Doc(0);
Assert.AreEqual("doc2", document.Get("id"));
Assert.AreEqual("The big red fox jumped", document.Get("content"));
This test passes, which confuses me a bit. I assume this means that Lucene.Net uses OR to search between terms, not AND, but I cannot find any information on how to actually perform AND searches.
The end result that I am going to is that if someone is looking for "Matthew Anderson", I do not want him to pick up documents that refer to "Matthew Dow", as this has no relation, form or form.