0
我第一次使用Lucene索引。我有一些在印地文和英文文件,我创建索引的文件内容。当我搜索索引时,我从所有的文件中得到结果,即使我的查询是英文单词,它也会返回印地文件。我已经添加了下面的代码。请告诉我我在哪里错了。Lucene索引搜索
IndexSearcher searcher = new IndexSearcher(directory);
QueryParser parser = new QueryParser("Content", analyzer);
while (condition)
{
Search(text, searcher, parser);
}
searcher.Close();
private static void Search(string text, IndexSearcher searcher, QueryParse parser)
{
Query query = parser.Parse(text);
Hits hits = searcher.Search(query);
int results = hits.Length();
for (int i = 0; i < results; i++)
{
Lucene.Net.Documents.Document doc = hits.Doc(i);
string show = doc.ToString();
float score = hits.Score(i);
/* insert doc id in database table*/
}
感谢所有