我是一个Lucene的完全noobie,迄今为止是一个巨大的巨大粉丝。在Lucene中搜索字段
我现在正在寻找一些关于如何通过c#和dotnet存储数据和搜索的资源。任何LINQ样品对我来说都是一大好处。
特别是如果我有一个文档有两个字段定义为说标题和说明,我怎么能在两个搜索?
在下面的示例中,我想同时搜索标题和说明字段。
例如:
doc = new Document();
text = "Oven leek pie";
doc.Add(new Field("title", text, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("instructions", "Bake for 40 minutes", Field.Store.YES, Field.Index.TOKENIZED));
iwriter.AddDocument(doc);
,然后;
// Parse a simple query that searches for "text":
Lucene.Net.QueryParsers.QueryParser parser = new QueryParser("title", analyzer);
Query query = parser.Parse("baked bacon and leek pizza");
非常好,谢谢。 – griegs 2010-07-21 01:12:13