从Sphinx查询获取50个随机行 [英] Get 50 random rows from Sphinx query

查看:76
本文介绍了从Sphinx查询获取50个随机行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过 sphinxClient lib 使用Sphinx的PHP网站.

I have a PHP website using Sphinx by sphinxClient lib.

我的Sphinx查询具有一些过滤器,并且限制为2500行.从2500行(可能会更少)中,我只想获取50个随机行.

My Sphinx query has some filters and a limit of 2500 rows. From the 2500 rows (could be less), I want to fetch just 50 random rows.

是否有一种仅使用狮身人面像的方法?

Is there a way to do it using only Sphinx?

原始查询已经按行的受欢迎程度进行了排序,主要思想是从2500个最受欢迎的产品中获取50个随机产品.因此,我无法随机排序

The original query already sorted by the popularity of the rows, the main idea is to get 50 random products from the 2500 most popular. Because of that I can't sort by random

推荐答案

使用RAND()限制50的订单有什么问题

What's the issue with using order by RAND() limit 50

检查此链接以获取类似结果. sphinxQL随机获取?

Check this link for similar result. sphinxQL fetching random?

这篇关于从Sphinx查询获取50个随机行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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