Lucene .NET结果子集 [英] Lucene .NET result subsets
问题描述
我正在使用Lucene .NET 假设我只想返回从结果100开始的50个结果,那我该怎么做呢? 我已经搜索过文档,但没有找到任何东西.有什么我想念的吗?
I am using Lucene .NET Let's say I want to only return 50 results starting at result 100, how might I go about that? I've searched the docs but am not finding anything. Is there something I'm missing?
推荐答案
我假设您这样做是出于分页的目的.通常在Lucene实现(包括Solr)中完成此操作的方式是,只需简单地正常执行查询,但仅实际为您感兴趣的结果加载存储的数据.
I assume you are doing this for the purpose of paging. The way this is normally done in a Lucene implementation (including Solr) is by simply executing the query normally, but only actually loading the stored data for the results you are interested in.
在典型的分页方案中,这可能意味着多次执行相同的查询,这似乎是对资源的浪费,但是在系统缓存和Lucene缓存的帮助下,情况还不错.好处是无状态,这使您可以扩展.
In a typical paging scenario, this may mean executing the same query multiple times, which may seem like a waste of resources, but with help from the system cache and possibly Lucene's caching it's not so bad. The benefit is statelessness, which allows you to scale.
这篇关于Lucene .NET结果子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!