*/ ?> <!DOCTYPE html> <html lang="es-ES"> <head> <meta charset="utf-8"> </head> <body> <?php /** * Example that will search in Sphinx the query passed as query string, like: * http://vagrant.dev:8080/sphinx/search_example.php?q=barcelona * * If we want to match substrings and we have 'enable_star' set to 1, we can use wildcards like * * $results = $sphinx->query($_GET['q'] . "*", 'municipios'); */ $results = $sphinx->query($_GET['q'], 'municipios'); if (!$results) { var_dump($sphinx->getLastError()); var_dump($sphinx->getLastWarning()); } else { echo "TOTAL: " . $results['total'] . "<br /><br />"; foreach ($results['matches'] as $municipio) { echo "{$municipio['attrs']['municipio']}<br />"; } }