1. Modify
/path/to/webroot/properties/geo_search.php
and add the following (highlighted) code:<?php /** * File: /path/to/webroot/properties/geo_search.php */ include('init.php'); // Get the data from form (if submitted) $latitude = !empty($_POST['latitude']) ? $_POST['latitude'] : ''; $longitude = !empty($_POST['longitude']) ? $_POST['longitude'] : ''; $radius = !empty($_POST['radius']) ? $_POST['radius'] : 5; // If we have coordinates then perform the search if (!empty($latitude) && !empty($longitude)) { // 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_FULLSCAN $client->SetMatchMode(SPH_MATCH_FULLSCAN); // Convert the latitude and longitude to radians $lat = $latitude * (M_PI / 180); $lon = $longitude * (M_PI / 180)...
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