为什么 django-sphinx 只输出 20 个结果?我怎样才能得到剩下的?
使用 django-sphinx 进行搜索会得到 results._sphinx ,它表示有 68 个结果,但是当我迭代它们时,我只能得到其中的前 20 个。
我确信有办法解决这个问题,而且这是设计使然,但它正式让我感到困惑。有人知道如何获取完整的查询集吗?
Doing a search using django-sphinx gives me results._sphinx that says there were 68 results, but when I iterate over them, I can only get at the first 20 of them.
I'm SURE there's a way around this, and that this is by design, but it's officially stumping the heck out of me. Does anybody know how to get the complete queryset?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我终于明白了这一点。
显然,在您访问查询集之前,查询集仅返回 20 个命中。或者类似的东西。
因此,如果您明确希望对整个事物进行迭代,则必须执行以下操作:
或者执行相应操作,这将显式查询整个事物。啊。这应该被清楚地记录下来......但事实并非如此。
I figured this out finally.
Apparently, the querysets only return 20 hits until you access the queryset. Or something like that.
So, if you explicitly want the iterate over the whole thing, you have to do:
Or something to that effect, which will query the entire thing explicitly. Ugh. This should be clearly documented...but it not.
通过源代码进行黑客攻击后,我显式设置了 _limit 变量。完成这项工作,并发出实际的限制:
After hacking through source, I set the _limit variable explicitly.. Does the job, and issues an actual limit:
为我工作:
在sphinx配置文件中:
在django代码中:
或在设置中:
work for me:
in sphinx config file:
in django code:
or in settings: