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 - create the index

  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 ...

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