downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SphinxClient::setMatchMode> <SphinxClient::setIndexWeights
[edit] Last updated: Fri, 25 May 2012

view this page in

SphinxClient::setLimits

(PECL sphinx >= 0.1.0)

SphinxClient::setLimitsConfigure l'offset et la limite du résultat

Description

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

Configure l'offset du résultat et la quantité de résultats à retourner au client à partir de cette position (avec l'argument limit). Peut aussi controler la taille maximale du jeu de résultats de la requête avec le paramètre max_matches, et le seuil minimum de résultats avec cutoff.

Liste de paramètres

offset

L'offset dans le résultat.

limit

Le nombre de résultats à retenir.

max_matches

Contrôle le nombre de résultats que searchd va conserver en RAM durant la recherche.

cutoff

Utilisé pour des contrôles avancés de performances. Il indique à searchd d'arrêter sa recherche lorsque cutoff ont été trouvés.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.



SphinxClient::setMatchMode> <SphinxClient::setIndexWeights
[edit] Last updated: Fri, 25 May 2012
 
add a note add a note User Contributed Notes SphinxClient::setLimits
xxxbunker dot com 21-Mar-2010 10:52
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.
shoanm at users dot sourceforge dot net 25-Aug-2009 03:06
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.
Nayana Hettiarachch nayana at corp-gems dot com 23-Jan-2009 08:36
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

 
show source | credits | stats | sitemap | contact | advertising | mirror sites