Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Sphinx Search Beginner's Guide

You're reading from  Sphinx Search Beginner's Guide

Product type Book
Published in Mar 2011
Publisher
ISBN-13 9781849512541
Pages 244 pages
Edition 1st Edition
Languages
Author (1):
Abbas Ali Abbas Ali
Profile icon Abbas Ali

Table of Contents (15) Chapters

Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Setting Up Sphinx Getting Started Indexing Searching Feed Search Property Search Sphinx Configuration What Next?

Time for action - creating the search form


  1. 1. Create a script /path/to/webroot/feeds/search.php with the following content:

    <?php
    /**
    * File: /path/to/webroot/feeds/search.php
    */
    include('init.php');
    // Get all the categories and their ids
    // This will be used to build the categories filter drop down
    $query = "SELECT id, name FROM categories ORDER BY name";
    foreach ($dbh->query($query) as $row) {
    $viewVars['cat_list'][$row['id']] = $row['name'];
    }
    // Render the page
    render('search');
    
  2. 2. Create the view for the search page at /path/to/webroot/feeds/views/search.thtml:

    <!-- File: /path/to/webroot/feeds/views/search.thtml -->
    <form action="search.php" method="post">
    <fieldset>
    <legend>Search Feeds</legend>
    <div class="input">
    <label>Search for:</label>
    <input type="text" name="q" value="" />
    </div>
    <div class="input">
    <label>Author:</label>
    <input type="text" name="author" value="" />
    </div>
    <...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}