Time for action - creating index (without attributes)
1. Create a new Sphinx configuration file at
/usr/local/sphinx/etc/sphinx-blog-xmlpipe2.conf
with the following options:source blog { type = xmlpipe2 xmlpipe_command = /usr/bin/php /home/abbas/sphinx/makeindex.php } index posts { source = blog path = /usr/local/sphinx/var/data/blog-xmlpipe2 docinfo = extern charset_type = utf-8 } indexer { mem_limit = 32M }
2. Create the PHP script
/home/abbas/sphinx/makeindex.php
(this script can be anywhere on your machine).<?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'...