O'Reilly logo

Sphinx Search by Abbas Ali

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - searching with extended query syntax

  1. Create a PHP script search_extended_mode.php in your webroot with following code:
    <?php // Include the api class Require_once('sphinxapi.php'); // Include the file which contains the function to display results Require_once('display_results.php'); $client = new SphinxClient(); // Set search options $client->SetServer('localhost', 9312); $client->SetConnectTimeout(1); $client->SetArrayResult(true); // Set the mode to SPH_MATCH_EXTENDED2 $client->SetMatchMode(SPH_MATCH_EXTENDED2); // Returns documents whose title matches "php" and // content matches "significant" display_results( $client->Query('@title php @content significant'), 'field search operator'); // Returns documents where "development" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required