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.
Lucene 允许您使用位置和偏移量来索引术语,但即使没有它也可以使用短语搜索。那么 lucene 如何在没有这些信息的情况下计算索引中的词序呢?
也许您将术语向量位置/偏移量与倒排索引混淆了。
术语向量不用于搜索。
要在实际发布列表中排除邻近信息:使用 IndexOptions.DOCS_ONLY 或 IndexOptions.DOCS_AND_FREQS。如果您这样做,PhraseQueries 将不起作用。
但是,如果您愿意接受一些不准确之处,这些设置可以与 word-ngram(shinglefilters)结合使用,用于快速短语“近似”......当然它们对于不接近的领域很有用适用:如数字字段、唯一ID字段等。