如何管理“分页”与索尔? [英] How to manage "paging" with Solr?

查看:112
本文介绍了如何管理“分页”与索尔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个分类广告网站...
我让Solr搜索分类广告,然后返回ID:nrs然后我用它来放入一个数组。然后我使用这个数组来查找MySql数据库中的任何分类,其中ID:s匹配Solr返回的数组中的ID:s。

I have a classifieds website... I have Solr doing the searching of the classifieds, and then return ID:nrs which I then use to put into an array. Then I use this array to find any classifieds in a MySql db where the ID:s match the ID:s in the array returned by Solr.

现在,因为这个数组可能非常大(100个记录或更多)然后我需要页面结果,以便可能在一次返回100。然后在MySql中使用这100个ID来查找分类广告。

Now, because this array can be very very big (100thousand records or more) then I would need to "page" the results so that maybe 100 where returned at a time. And then use those 100 ID:s in MySql to find the classifieds.

那么,是否可以使用SOLR进行寻呼?

So, is it possible to page with SOLR?

如果是这样,怎么样?我需要示例代码......结果会是什么样的结果。

And if so, how? I need example code... And what the results would be please.

大多数情况下我需要一个完整的例子!

Mostly I need a thorough example!

谢谢

推荐答案

看看 IBM 。也许这会让你走上正确的路线。

Take a look at IBM. Maybe that will get you on the right course.


结果数量:指定要返回的最大结果数。

Number of results: Specifies the maximum number of results to return.

开始:结果集中开始的偏移量。这对于分页很有用。

Start: The offset to start at in the result set. This is useful for pagination.

所以你可能想要一些变化

So you probably want some variation on

<str name="rows">10</str>
<str name="start">0</str>

你的solr客户端应该提供一些方法来获得结果总数而不会有太多麻烦。

Your solr client should provide some way to get the total number of results without much trouble.

这篇关于如何管理“分页”与索尔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆