1. Create the Sphinx configuration file at
/usr/local/sphinx/etc/feeds.conf
with the following content:source feeds { type = xmlpipe2 xmlpipe_command = /usr/bin/php /path/to/webroot/feeds/makeindex.php xmlpipe_field = title xmlpipe_field = description xmlpipe_field = author xmlpipe_attr_timestamp = pub_date xmlpipe_attr_multi = category_id } index feed-items { source = feeds path = /usr/local/sphinx/var/data/feed-items charset_type = utf-8 } indexer { mem_limit = 64M }
2. Create the PHP script,
/path/to/webroot/feeds/makeindex.php
, to stream the XML required for indexing:<?php require('init.php'); require('simplepie.inc'); // Instantiate the simplepie class // We will use simplepie to parse the feed xml $feed = new SimplePie(); // We don't want to cache feed items $feed->enable_cache(false); $feed->set_timeout(30); // We will use PHP's inbuilt XMLWriter to create the xml structure $xmlwriter = new XMLWriter(); $xmlwriter->openMemory();...
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