Lucene SpanQuery - what is it good for?

2019-03-11 01:28发布

Can someone explain or provide a link to an explanation of what a SpanQuery is, and what are typical use cases for it?

The javadoc is very laconic, and keeps mentioning the concept of "Span", which I'm not quite sure I get.

Also, I'm interested in the SpanScorer in the highlighter, and what it does exactly.

标签: lucene
4条回答
太酷不给撩
2楼-- · 2019-03-11 01:35

A span query is a query that returns infomation about where in a document each match took place. You use the getSpans() method to get the locations.

The following deck of slides (unfortunately in Powerpoint) contain an example: http://www.cnlp.org/apachecon2005/AdvancedLucene.ppt

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-03-11 01:46

Found this all about the SpanQuery

查看更多
Deceive 欺骗
4楼-- · 2019-03-11 01:49

Spans provide a proximity search feature to Lucene. They are used to find multiple terms near each other, without requiring the terms to appear in a specified order. You can specify the terms that you want to find, and how close they must be. You can combine these span queries with each other or with other types of Lucene queries.

查看更多
ら.Afraid
5楼-- · 2019-03-11 01:54

The javadocs you linked to are for a class in the " org.apache.lucene.search.spans " package. if you had clicked on the "package" link on those javadocs you would have been taken to...

https://lucene.apache.org/core/4_10_0/core/org/apache/lucene/search/spans/package-summary.html

...where the concept of Spans and what a Span is are explained in depth.

查看更多
登录 后发表回答