SphinxClient::setLimits

(PECL sphinx >= 0.1.0)

SphinxClient::setLimitsSet offset and limit of the result set

Description

public bool SphinxClient::setLimits ( int $offset , int $limit [, int $max_matches = 0 [, int $cutoff = 0 ]] )

Sets offset into server-side result set and amount of matches to return to client starting from that offset (limit). Can additionally control maximum server-side result set size for current query (max_matches) and the threshold amount of matches to stop searching at (cutoff).

Parameters

offset

Result set offset.

limit

Amount of matches to return.

max_matches

Controls how much matches searchd will keep in RAM while searching.

cutoff

Used for advanced performance control. It tells searchd to forcibly stop search query once cutoff matches have been found and processed.

Return Values

Returns TRUE on success or FALSE on failure.

Коментарии

If you get an error 
per-query max_matches=0 out of bounds (per-server max_matches=1000).

make sure that you also set the $max to a value other than the default 0, 

there is an issue published with a patch if you feel like wanting to patch, 

the first option works well as a workaround. 

http://sphinxsearch.com/bugs/view.php?id=208
2009-01-23 10:36:08
http://php5.kiev.ua/manual/ru/sphinxclient.setlimits.html
I almost pulled out all my hair trying to figure this one out. After applying limits using

$s->setLimit(10,10); 

the search kept returning only false. getLastError() and getLastWarning() contained empty strings. 

The solution, like Nayana stated, is to add a positive non-zero integer $max to setLimit.
2009-08-25 06:06:12
http://php5.kiev.ua/manual/ru/sphinxclient.setlimits.html
Автор:
the max_matches / cutoff parameters are priceless.

if you ever have a situation where you need a 'count' of the number of matches, but only need to display lets say the 'top 10', these 2 parameters are very handy.

we used to get the occasional 'unable to connect' error with sphinx, after implementing these 2 parameters where applicable, these issues disappeared, load dropped, and the servers were much happier.
2010-03-22 00:52:03
http://php5.kiev.ua/manual/ru/sphinxclient.setlimits.html
If you use shpinxQL, you can add "max_matches" option to your query:

<?php
   SELECT 
... LIMIT 100010 OPTION max_matches 1000
?>

And to "searchd" section in sphinx.conf:

<?php

searchd 
{
    ...
   
max_matches 10000
   
....
}

?>
2016-02-02 09:26:41
http://php5.kiev.ua/manual/ru/sphinxclient.setlimits.html

    Поддержать сайт на родительском проекте КГБ