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'...
Sphinx Search Beginner's Guide
By :
Sphinx Search Beginner's Guide
By:
Overview of this book
Table of Contents (15 chapters)
Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Setting Up Sphinx
Getting Started
Indexing
Searching
Feed Search
Property Search
Sphinx Configuration
Customer Reviews