我可以轻松地对直接来自 couchdb 的结果进行分页(使用 startkey 和 limit),但看起来 couchdb-lucene 不处理请求中传递的“startkey”参数。我仍然可以使用“skip”,但据我记得,这是一种已弃用的沙发分页方式。
那么,还有其他方法可以使用 couchdb-lucene 进行有效分页吗?
最佳答案
我认为您正在寻找 couchdb-lucene 的 skip
和 limit
查询参数。
引用couchdb-lucene documentation
skip
: the number of results to skip
limit
: the maximum number of results to return
我意识到您试图避免处理所有跳过的文档,但核心 Lucene 并没有为 couchdb-lucene 提供任何帮助:
引用Apache Lucene documentation :
How do I implement paging, i.e. showing result from 1-10, 11-20 etc?
Just re-execute the search and ignore the hits you don't want to show. As people usually look only at the first results this approach is usually fast enough.
关于lucene - 来自 couchdb-lucene 的分页结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5389172/