Sphinx Search Beginner's Guide

Sphinx Search Beginner's Guide

Abbas Ali

Language: English

Pages: 244

ISBN: 184951254X

Format: PDF / Kindle (mobi) / ePub

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.

What you will learn from this book

  • Install Sphinx on your system
  • Create indexes in Sphinx by using Sphinx's indexer utility
  • Use the Sphinx API to issue search queries from your PHP applications
  • Filter your search results using different attributes
  • Create a functional application in PHP that will use the Sphinx search engine as the backend to serve search queries
  • Use PHP to create an application that fetches different feeds and stores the feed item data in a Sphinx index
  • Create an advanced search form that implements lots of filters, as well as a search form for geodistance searches
  • Explore the different configuration options available in the Sphinx configuration file that tailor Sphinx according to your needs


This book is a step-by-step guide for an absolute beginner. It covers everything, from installing to configuring, to get you started quickly. It has numerous code examples that the reader can try on their own and learn while doing so. It has two full-fledged applications as examples that readers can follow. This book is specifically focused on the Search feature of web applications

Who this book is written for

This book is for developers who are new to Sphinx Search. All code examples use PHP but the logic is same for any other web scripting languages as well.

LPIC-1: Linux Professional Institute Certification Study Guide: Exams 101 and 102 (3rd Edition)

The Ruby Programming Language

No Code Required: Giving Users Tools to Transform the Web

Just Spring Data Access

GIS for Dummies



















Different kind of attributes that go into the index ‹‹ We took a look at how to create the Sphinx configuration file ‹‹ We learned about SQL data source and xmlpipe data source ‹‹ We learned how to use different kind of attributes so that we can filter our search results In the next chapter we will see how to use the Sphinx API to search from within your application. We will use the same index used in this chapter and fire queries from our PHP application to get the results. [ 71 ] 4.

Chapter 4 The fourth search query used the NOT operator. In this case, the word that comes just after the NOT operator should not be present in the matched results. So "php –programming" will return all documents that match "php" but do not match "programming" We get results as seen in the following screenshot: Next, we used the grouping operator. This operator is used to group other operators. We searched for "(php & programming) | (leadership & success)", and this returned all documents.

`items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `guid` varchar(32) NOT NULL, `link` varchar(255) NOT NULL, `pub_date` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `guid` (`guid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; What just happened? We created a new database which will be used by our PHP application. We then created the following tables: ‹‹ categories: This table will hold the category names. A category is a collection of items sharing common attributes.

Empty($viewVars['results']['matches'])): ?>

No matching properties found!!!

Total '.$viewVars['results']['total_found']. ' properties found

'; print '