如何从Lucene.net获得更多 [英] How to get more out of Lucene.net
问题描述
我正在尝试将Lucene.net纳入我的网络搜索.
I'm trying to incorporate Lucene.net in my web search.
当前,我有一个lucene.net索引,其中包含+1百万个文档,每个文档有7个字段. 最后一个字段是所有"字段,其中前面的字段的内容已连接在一起.搜索所有字段非常快:)
Currently I have a lucene.net index that contains +1 million documents with 7 fields each. The last field is the "all" field that has the content of the previous fields concatenated. Searching the all field is just EXTREMELY fast :)
但是我觉得这里还有更多.如何在不使用全部"字段的情况下,在所有字段中搜索一个或多个以空格分隔的字符串?
我希望能够权衡某些领域.此外,如果搜索中包含有关命中发生的位置的信息,这样我就可以在结果中显示它,那将是非常不错的.
But I feel there is more to be found here. How can I make a search that searches one or more space separated strings over all the fields without using the "all" field?
I want to be able to give weights to certain fields. Furthermore it would be really nice if the search contained information on WHERE the hit took place so I can show it in the result.
我认为这是有可能的,但是我并没有毫不费力地看到如何做.
有帮助吗?
I think this is all possible, but I don't immideatelly see how.
Any help?
推荐答案
我认为您不需要维护全部"字段.
I don't think you need to maintain an "all" field.
- 使用"MultiFieldQueryParser"进行研究.它接受一个字段名数组(除了索引分析器之外),而不是使用查询解析器要使用的单个默认字段.
- 术语提升应按照"QueryParser"的要求运行(即无需采取特殊措施).我应该补充一点,我发现标准评分对我来说似乎不错(字段长度,比赛次数等),而无需使用增强术语.
- Lucene.Net(当然,目前可以构建SVN 2.3)包括来自Java源代码的Highlight包的端口.它确实有几个怪癖(最重要的是,一开始它可能很棘手),但它基本上是有效的.
祝你好运
这篇关于如何从Lucene.net获得更多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!