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 - Adding an MVA to the index

  1. Once again modify the sphinx-blog.conf file to add/modify the options as highlighted next:
    source blog
    {
    type = mysql
    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = myblog
    sql_query = \
    SELECT id, title, content, UNIX_TIMESTAMP(publish_date) \
    AS publish_date, author_id FROM posts
    sql_attr_uint = author_id
    sql_attr_multi = uint category_id from query; \
    SELECT post_id, category_id FROM posts_categories
    sql_attr_timestamp = publish_date
    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. Run the indexer again to re-index the data:
    $ /usr/local/sphinx/bin/indexer ...

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