There is also a "status" key showing in what status query has ended.
Here are codes, taken from searchd.cpp:
<?php
/// known status return codes
enum SearchdStatus_e
{
SEARCHD_OK = 0, ///< general success, command-specific reply follows
SEARCHD_ERROR = 1, ///< general failure, error message follows
SEARCHD_RETRY = 2, ///< temporary failure, error message follows, client should retry later
SEARCHD_WARNING = 3 ///< general success, warning message and command-specific reply follow
};
?>
SphinxClient::query
(PECL sphinx >= 0.1.0)
SphinxClient::query — Exécute une requête de recherche
Description
public array SphinxClient::query
( string
$query
[, string $index = "*"
[, string $comment = ""
]] )Se connecte au serveur searchd, exécute une requête de recherche, puis lit les résultats obtenus.
Liste de paramètres
-
query -
La chaîne de requête.
-
index -
Un nom d'index (ou plusieurs noms).
-
comment -
Valeurs de retour
En cas de réussite, la fonction SphinxClient::query() retourne une liste d'occurrences, et des statistiques de requête. Le jeu de résultats est un tableau associatif avec les index suivants :
| Index | Description |
|---|---|
| "matches" | Un tableau avec les identifiants de documents comme clé, et leur poids et attributs comme valeur. |
| "total" | Le nombre total de résultats trouvés, et lus (cela dépend de la configuration) |
| "total_found" | Le nombre total de document trouvés, en accord avec la requête |
| "words" | Un tableau de mots (avec casse standard et racine), ainsi que des statistiques de mot comme valeur |
| "error" | Le message d'erreur de requête, tel de signalé par searchd |
| "warning" | L'alerte, rapportée par searchd |
php at senz dot su ¶
2 years ago
moosh at php dot net ¶
2 years ago
public array SphinxClient::query ( string $query [, string $index = "*" [, string $comment = "" ]] )
If you add a value for comment, you can retrieve them in sphinx query log.
fkoehl at gmail dot com ¶
4 years ago
It appears that Query() (or the Sphinx program in general) does have some kind of limit imposed on the maximum length of a query submission. Stumbled across this limitation when trying to perform some searches based on content from user-submitted e-mails.
In looking at the returned array, the 'words' portion only accounts for the first 8 or 9 words of the long query. I'm assuming that the rest of the string is being truncated. The number of accepted words appears to change based on the total length of the words. Just a heads-up.
