O'Reilly logo

Sphinx Search by Abbas Ali

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - creating indexes for distributed searching

  1. Create the configuration file on the first server (192.168.1.1) at /usr/local/sphinx/etc/sphinx-distributed.conf with the following content:
    source items { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = sphinx_conf # Query to set MySQL variable @total #which holds total num of rows sql_query_pre = SELECT @total := count(id) FROM items # Set a variable to hold the sql query # We are using CONCAT to use a variable in limit clause # which is not possible in direct query execution sql_query_pre = SET @sql = CONCAT('SELECT * FROM items \ limit 0,', CEIL(@total/2)) # Prepare the sql statement sql_query_pre = PREPARE stmt FROM @sql # Execute the prepared statement. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required