阅读背景:

更快地从Lucene Query获取不同值的方法

来源:互联网 

Currently I do like this:

目前我喜欢这样:

IndexSearcher searcher = new IndexSearcher(lucenePath);
Hits hits = searcher.Search(query);
Document doc;
List<string> companyNames = new List<string>();

for (int i = 0; i < hits.Length(); i++)
{
    doc = hits.Doc(i);
    companyNames.Add(doc.Get("companyName"));
}
searcher.Close();

companyNames = companyNames.Distinct<string>().Skip(offSet ?? 0).ToList();
return companyNames.Take(count??companyNames.Count()).ToList();
IndexSea



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: