Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Sphinx Search Beginner's Guide

You're reading from  Sphinx Search Beginner's Guide

Product type Book
Published in Mar 2011
Publisher
ISBN-13 9781849512541
Pages 244 pages
Edition 1st Edition
Languages
Author (1):
Abbas Ali Abbas Ali
Profile icon Abbas Ali

Table of Contents (15) Chapters

Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Setting Up Sphinx Getting Started Indexing Searching Feed Search Property Search Sphinx Configuration What Next?

Time for action - creating a basic search script


  1. 1. Add the searchd config section to /usr/local/sphinx/etc/sphinx-blog.conf:

    source blog {
    # source options
    }
    index posts {
    # index options
    }
    indexer {
    # indexer options
    }
    # searchd options (used by search daemon)
    searchd
    {
    listen = 9312
    log = /usr/local/sphinx/var/log/searchd.log
    query_log = /usr/local/sphinx/var/log/query.log
    max_children = 30
    pid_file = /usr/local/sphinx/var/log/searchd.pid
    }
    
  2. 2. Start the searchd daemon (as root user):

    $ sudo /usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/sphinx-blog.conf
    
  3. 3. Copy the sphinxapi.php file (the class with PHP implementation of Sphinx API) from the sphinx source directory to your working directory:

    $ mkdir /path/to/your/webroot/sphinx
    $ cd /path/to/your/webroot/sphinx
    $ cp /path/to/sphinx-0.9.9/api/sphinxapi.php .
    
    
  4. 4. Create a simple_search.php script that uses the PHP client API class to search the Sphinx-blog index, and execute it in the browser:

    <?php
    require_once('sphinxapi.php...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}