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 - add attributes to schema

  1. Modify /home/abbas/sphinx/makeindex.php file and make the changes as highlighted next:
    <?php // Database connection credentials $dsn ='mysql:dbname=myblog;host=localhost'; $user = 'root'; $pass = ''; // Instantiate the PDO (PHP 5 specific) class try { $dbh = new PDO($dsn, $user, $pass); } catch (PDOException $e){ echo'Connection failed: '.$e->getMessage(); } // We will use PHP's inbuilt XMLWriter to create the xml structure $xmlwriter = new XMLWriter(); $xmlwriter->openMemory(); $xmlwriter->setIndent(true); $xmlwriter->startDocument('1.0', 'UTF-8'); // Start the parent docset element $xmlwriter->startElement('sphinx:docset'); // Start the element for schema definition $xmlwriter->startElement('sphinx:schema'); ...

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