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 - using morphology for stemming


  1. 1. Create the Sphinx configuration file /path/to/sphinx-stem.conf as follows:

    source items
    {
    type = mysql
    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = sphinx_conf
    sql_query = SELECT id, title, content, created FROM items
    sql_attr_timestamp = created
    }
    index items
    {
    source = items
    path = /usr/local/sphinx/var/data/items-morph
    charset_type = utf-8
    morphology = stem_en
    }
    
  2. 2. Run the indexer command:

    $/usr/local/sphinx/bin/indexer -c /path/to/sphinx-stem.conf items
    
  3. 3. Search for the word run using the command line search utility:

    $/usr/local/sphinx/bin/search -c /path/to/sphinx-stem.conf run
    
  4. 4. Search for the word running:

    $/usr/local/sphinx/bin/search -c /path/to/sphinx-stem.conf running
    

What just happened?

We created a configuration file to test the morphology option with the value stem_en. We then indexed the data and ran a few searches. Let's try to understand the results.

Firstly we searched for the word run. None of the records in...