0%

Book Description

Implement full-text search with lightning speed and accuracy using Sphinx

  • Create applications with full-text search functionality
  • Build indexes from varied data sources
  • Use the Sphinx client API implementation in your application to fire full text-search queries
  • Filter, sort, and group results based on different attributes
  • Search with different matching and ranking modes
  • Each chapter is explained using plenty of real-world examples

In Detail

Sphinx is an open-source full-text search server, designed from the ground up with a focus on performance, relevance, and integration simplicity. With Sphinx, you can either batch index and search data stored in an SQL database, NoSQL storage, or just files quickly and easily — or index and search data on the fly, working with Sphinx pretty much as a database server.

Sphinx Search Beginner's Guide serves as a guide to everything you need to know about running a Sphinx Search Engine. In today's world, search is an integral part of any application and having a reliable search engine like Sphinx Search can be the difference between running a successful and unsuccessful business. What good is being on the Web if no one knows you are there? It is easy to build a proficient search engine with Sphinx Search Beginner's Guide to hand.

This practical guide provides insight into one of the most popular open source search engines, Sphinx. You will learn how to set up Sphinx on your own server, with the basics of how a search engine works explained in brief. You will learn how to create an index using Sphinx and then perform a search on that index using the client API, as well as learning how to configure Sphinx to get the most out of it. You will also be shown how Sphinx gives quality search results by relevance ranking. The book will help a beginner in all possible ways to create both simple and complex search forms in their applications. It's easy to use Sphinx Search engine, when you have the Sphinx Search Beginner's Guide to hand.

Table of Contents

  1. Sphinx Search
    1. Table of Contents
    2. Sphinx Search
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. Who this book is for
      3. Conventions
      4. Time for action - heading
        1. What just happened?
        2. Pop quiz - heading
        3. Have a go hero - heading
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    9. 1. Setting Up Sphinx
      1. What you need to know
      2. Different ways of performing a search
        1. Searching on a live database
        2. Searching an index
      3. Sphinx—a full-text search engine
        1. Features
        2. A brief history
        3. License
      4. Installation
        1. System requirements
        2. Sphinx on a Unix-based system
      5. Time for action - installation on Linux
        1. What just happened?
        2. Options to the configure command
        3. Known issues during installation
        4. Sphinx on Windows
      6. Time for action - installation on Windows
        1. What just happened?
        2. Sphinx on Mac OS X
      7. Time for action - installation on a Mac
        1. What just happened?
        2. Other supported systems
      8. Summary
    10. 2. Getting Started
      1. Checking the installation
      2. Full-text search
        1. What is full-text search?
        2. Traditional search
      3. Time for action - normal search in MySQL
        1. What just happened?
        2. MySQL full-text search
        3. Advantages of full-text search
        4. When to use a full-text search?
      4. Overview of Sphinx
        1. Primary programs
      5. Time for action - Sphinx in action
        1. What just happened?
        2. Data to be indexed
        3. Creating the Sphinx configuration file
        4. Searching the index
        5. Have a go hero -
      6. Why use Sphinx for full-text searching?
      7. Summary
    11. 3. Indexing
      1. What are indexes?
        1. Indexes in Sphinx
      2. Index attributes
        1. Types of attributes
          1. Multi-value attributes (MVA)
      3. Data sources
        1. How to define the data source?
        2. SQL data sources
          1. Creating Index using SQL data source (Blog)
            1. Creating a simple index without any attributes
      4. Time for action - creating database tables for a blog
        1. What just happened?
      5. Time for action - populate the database tables
        1. What just happened?
      6. Time for action - creating the Sphinx configuration file
        1. What just happened?
          1. The indexing workflow
          2. Adding attributes to the index
      7. Time for action - adding attributes to the index
        1. What just happened?
          1. Adding an MVA to the index
      8. Time for action - Adding an MVA to the index
        1. What just happened?
          1. Filtering without searching for a specific phrase
        2. xmlpipe data source
        3. xmlpipe2 data source
          1. Indexing with schema defined in XML stream
      9. Time for action - creating index (without attributes)
        1. What just happened?
      10. Time for action - add attributes to schema
        1. What just happened?
          1. Indexing with schema defined in configuration file
      11. Time for action - create index with schema defined in configuration file
        1. What just happened?
      12. Summary
    12. 4. Searching
      1. Client API implementations for Sphinx
      2. Search using client API
      3. Time for action - creating a basic search script
        1. What just happened?
        2. Matching modes
      4. Time for action - searching with different matching modes
        1. What just happened?
        2. Boolean query syntax
      5. Time for action - searching using Boolean query syntax
        1. What just happened?
        2. Extended query syntax
      6. Time for action - searching with extended query syntax
        1. What just happened?
      7. Filtering full-text search results
      8. Time for action - filtering the result set
        1. What just happened?
      9. Weighting search results
      10. Time for action - weighting search results
        1. What just happened?
      11. Sorting modes
      12. Grouping search results
      13. Summary
    13. 5. Feed Search
      1. The application
        1. Tools and software used while creating this application
        2. Database structure
      2. Time for action - creating the MySQL database and tables
        1. What just happened?
        2. Basic setup
      3. Time for action - setting up the feeds application
        1. What just happened?
        2. Add feed
      4. Time for action - creating a form to add feeds
        1. What just happened?
        2. Saving the feed data
      5. Time for action - adding code to save feed
        1. What just happened?
        2. Indexing the feeds
      6. Time for action - create the index
        1. What just happened?
        2. Check for duplicate items
      7. Time for action - adding code to avoid duplicate items
        1. What just happened?
        2. Index merging
      8. Time for action - adding the delta index
        1. What just happened?
        2. Search form
      9. Time for action - creating the search form
        1. What just happened?
        2. Perform the search query
      10. Time for action - adding code to perform a search query
        1. What just happened?
        2. Applying filters
      11. Time for action - adding code to filter the results
        1. What just happened?
      12. Time for action - showing search form prefilled with last submitted data
        1. What just happened?
        2. Re-indexing
        3. Have a go hero - trying different search queries
      13. Summary
    14. 6. Property Search
      1. The application
        1. Tools and software used while creating this application
        2. Database structure
      2. Time for action - creating the MySQL database and structure
        1. What just happened?
        2. Initial data
      3. Time for action - populating the database
        1. What just happened?
        2. Basic setup
      4. Time for action - setting up the application
        1. What just happened?
        2. Adding a property
      5. Time for action - creating the form to add property
        1. What just happened?
        2. Indexing the properties
      6. Time for action - creating the index
        1. What just happened?
        2. Simple search form
      7. Time for action - creating the simple search form
        1. What just happened?
        2. Full-text search
      8. Time for action - adding code to perform full-text search
        1. What just happened?
        2. Have a go hero - try setting different field weights
        3. Advanced search
      9. Time for action - creating the Advanced search form
        1. What just happened?
        2. Ranged filters
      10. Time for action - adding ranged filters
        1. What just happened?
        2. Have a go hero - adding filter for amenities
        3. Geo distance search
      11. Time for action - creating the search form
        1. What just happened?
        2. Add geo anchor
      12. Time for action - adding code to perform geo distance search
        1. What just happened?
        2. Have a go hero - adding the delta index using the index merging technique
      13. Summary
    15. 7. Sphinx Configuration
      1. Sphinx configuration file
        1. Rules for creating the configuration file
      2. Data source configuration
        1. SQL related options
          1. Connection options
            1. sql_port
            2. sql_sock
            3. odbc_dsn
          2. Options to fetch data (SQL data source)
            1. sql_query_pre
            2. sql_query_post
            3. sql_query_post_index
            4. sql_ranged_throttle
        2. Configuration file using advanced options
      3. Time for action - creating a configuration with advanced source options
        1. What just happened?
        2. MS SQL specific options
          1. mssql_winauth
          2. mssql_unicode
      4. Index configuration
        1. Distributed searching
          1. Set up an index on multiple servers
      5. Time for action - creating indexes for distributed searching
        1. What just happened?
          1. Set up the distributed index on the primary server
      6. Time for action - adding distributed index configuration
        1. What just happened?
          1. agent_blackhole
          2. agent_connect_timeout
          3. agent_query_timeout
          4. Distributed searching on single server
        2. charset configuration
          1. charset_type
          2. charset_table
        3. Data related options
          1. stopwords
          2. min_word_len
          3. ignore_chars
          4. html_strip
          5. html_index_attrs
          6. html_remove_elements
        4. Word processing options
          1. Morphology
      7. Time for action - using morphology for stemming
        1. What just happened?
          1. morphology
          2. min_stemming_len
          3. Wordforms
      8. Search daemon configuration
        1. listen
        2. log
        3. query_log
        4. read_timeout
        5. client_timeout
        6. max_children
        7. pid_file
        8. max_matches
        9. seamless_rotate
      9. Indexer configuration
        1. mem_limit
        2. max_iops
        3. max_iosize
        4. max_xmlpipe2_field
      10. Summary
    16. 8. What Next?
      1. SphinxQL
        1. SphinxQL in action
      2. Time for action - querying Sphinx using MySQL CLI
        1. What just happened?
        2. SELECT
          1. Column list clause
            1. FROM clause
            2. WHERE clause
            3. GROUP BY clause
            4. ORDER BY clause
            5. LIMIT clause
            6. OPTION clause
          2. SHOW WARNINGS
          3. SHOW STATUS
          4. SHOW META
      3. Use case scenarios
      4. Popular websites using Sphinx
      5. Summary
    17. Index