1. Create a database (or use an existing one) with the following structure and data:
CREATE TABLE `items` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `title` VARCHAR( 255 ) NOT NULL , `content` TEXT NOT NULL , `created` DATETIME NOT NULL ) ENGINE = MYISAM ; CREATE TABLE `last_indexed` ( `id` INT NOT NULL ) ENGINE = MYISAM ; INSERT INTO `last_indexed` ( `id` ) VALUES ( '0' );
2. Add a few rows to the items table so that we get some data to index.
3. Create the Sphinx configuration file
/usr/local/sphinx/etc/sphinx-src-opt.conf
with the following content:source items { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = sphinx_conf # Set the charset of returned data to utf8 sql_query_pre = SET NAMES utf8 # Turn of the query cache sql_query_pre = SET SESSION query_cache_type = OFF sql_query_range = SELECT MIN(id), MAX(id) FROM items \ WHERE id >= (SELECT id FROM last_indexed) sql_range_step = 200...
Sphinx Search Beginner's Guide
By :
Sphinx Search Beginner's Guide
By:
Overview of this book
Table of Contents (15 chapters)
Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Setting Up Sphinx
Getting Started
Indexing
Searching
Feed Search
Property Search
Sphinx Configuration
Customer Reviews