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 - creating the Sphinx configuration file


  1. 1. Create the file /usr/local/sphinx/etc/sphinx-blog.conf with the following content:

    source blog
    {
    type = mysql
    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = myblog
    sql_query = SELECT id, title, content FROM posts
    sql_query_info = SELECT id, title FROM posts WHERE ID=$id
    }
    index posts
    {
    source = blog
    path = /usr/local/sphinx/var/data/blog
    docinfo = extern
    charset_type = sbcs
    }
    indexer
    {
    mem_limit = 32M
    }
    
  2. 2. Run the following command to create the index:

    $ /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx-blog.conf --all
    
  3. 3. Now test the index by searching from the command line search utility:

    $ /usr/local/sphinx/bin/search --config /usr/local/sphinx/etc/sphinx-blog.conf php
    

What just happened?

We created a configuration file /usr/local/sphinx/etc/sphinx-blog.conf, which is later used by Sphinx to create an index.

The first block in the configuration file defines the data source named blog which is of type...