我正在使用Lucene.net来实现web应用程序的搜索功能。我想搜索构成一个以上的精确匹配(基于短语)的位置,并排除其他匹配结果(基于单词),反之亦然。我应该使用什么方法?是否可以在Lucene.net中对短语进行索引?
发布于 2012-02-13 23:42:55
是,使用PhraseQueries
http://lucene.apache.org/core/old_versioned_docs/versions/2_9_4/api/all/org/apache/lucene/search/PhraseQuery.html
如果使用QueryParser,则用引号指定短语,即:"this is a phrase“
http://lucene.apache.org/core/old_versioned_docs/versions/3_0_0/queryparsersyntax.html
https://stackoverflow.com/questions/9262164
复制相似问题