Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我想用 2 个术语查询搜索索引。我可以用PhraseQuery(term1, term2, slop = 2) or with SpanNearQuery(term1, term2, slop=2, ordered=false). 这些配置的 lucene 评分有什么区别?
PhraseQuery(term1, term2, slop = 2) or with SpanNearQuery(term1, term2, slop=2, ordered=false)
据我所知,带有 slop 的短语查询将对短语进行标记,然后在每个标记之间应用 slop 距离,而在跨度查询中,短语将被保留为一个单元。
因此,如果您有一个短语查询"cat dog bird"with slop 3,它会匹配cat horse lizard dog bird。
"cat dog bird"
3
cat horse lizard dog bird
"cat dog" bird但是对于with slop的跨度查询3将不匹配cat horse lizard dog bird,因为cat并且dog不相邻。但是,它会匹配:cat dog horse lizard bird.
"cat dog" bird
cat
dog
cat dog horse lizard bird