Book Image

Sphinx Search Beginner's Guide

By : Abbas Ali
Book Image

Sphinx Search Beginner's Guide

By: Abbas Ali

Overview of this book

Table of Contents (15 chapters)
Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface

Time for action - adding code to perform a search query


  1. 1. Modify the Sphinx configuration file /var/local/sphinx/etc/feeds.conf and add section for searchd:

    # Other options (not shown for brevity)
    index feed-items-delta : feed-items
    {
    source = feeds-delta
    path = /usr/local/sphinx/var/data/feed-items-delta
    }
    indexer
    {
    mem_limit = 64M
    }
    searchd
    {
    listen = 9312
    log = /usr/local/sphinx/var/log/feeds-searchd.log
    query_log = /usr/local/sphinx/var/log/feeds-query.log
    max_children = 30
    pid_file = /usr/local/sphinx/var/log/feeds-searchd.pid
    }
    
  2. 2. Stop the searchd daemon (as root). You need to do this only if searchd is already running:

    $ /usr/local/sphinx/bin/searchd -c /path/to/sphinx.conf --stop
    
  3. 3. Start the searchd daemon (as root):

    $ /usr/local/sphinx/bin/searchd c /usr/local/sphinx/etc/feeds.conf i feed-items
    
  4. 4. Modify search.php and add the following (highlighted) code:

    <?php
    /**
    * File: /path/to/webroot/feeds/search.php
    */
    include('init.php');
    // Get the data from post if form is submitted...