1. Start the
searchd
daemon (as root):$ /usr/local/sphinx/bin/searchd c /usr/local/sphinx/etc/properties.conf
2. Modify
index.php
and add the following (highlighted) code:<?php /** * File: /path/to/webroot/properties/index.php */ include('init.php'); // Get the list of cities $query = "SELECT id, name FROM cities"; foreach ($dbh->query($query) as $row) { $viewVars['cities'][$row['id']] = $row['name']; } $q = !empty($_POST['q']) ? $_POST['q'] : ''; $city = !empty($_POST['city_id']) ? $_POST['city_id'] : ''; // If we have the search term if (!empty($q)) { // Include the api class require_once('sphinxapi.php'); $client = new SphinxClient(); // Set search options $client->SetServer('localhost', 9312); $client->SetConnectTimeout(1); $client->SetArrayResult(true); // Set the mode to SPH_MATCH_ANY $client->SetMatchMode(SPH_MATCH_ANY); // Weights for each field $weights = array( 'description' => 1, 'address' => 10...
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