PHP
  Home arrow PHP arrow Performing Full-text and Boolean Searches with MySQL
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Performing Full-text and Boolean Searches with MySQL
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2007-06-06


    Table of Contents:
  • Performing Full-text and Boolean Searches with MySQL
  • Running SELECT queries using a common approach
  • Using full-text searches with MySQL
  • Building the Web Form

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Performing Full-text and Boolean Searches with MySQL
    ( Page 1 of 4 )

    When a database-driven web site grows past a certain size, it requires an internal search engine. If it is a very big site, it may be desirable for visitors to be able to use full-text searches and Boolean operators to find the information they need. This article, the first of a three-part series, explains why and shows you how to work with full-text and Boolean searches using MySQL and PHP 5.

    Introduction

    These days it's not unusual for developers to find themselves building web sites that use database tables as their back ends. These databases are designed from the very beginning to store plain contents (not HTML output). The popularity of such sites is growing over time with those who build them, since databases allow for easy separation of these contents from their visual presentation.

    Naturally, creating maintainable database-driven web sites comes at a cost. The procedure requires the developer to handle a completely separate piece of software, like the database server, in addition to having a basic background in the so-called SQL (Standard Query Language). However, these issues seem to be rather insignificant once a web site is up and running and delivering its database contents quickly and smoothly to different users.

    But what happens when the web site in question has grown beyond the expected boundaries and needs an internal search engine? Well, nothing too serious actually. This kind of application can be quickly developed by providing users with a simple web form to enter different search terms, and then implementing the business logic that will return the corresponding results from one or more database tables to visitors.

    Nonetheless, the scenario described above can be much more complicated if the hard-coded SQL queries used by the search engine are returning massive amounts of data. This much data can sometimes be irrelevant to certain users, and definitely can consume precious server resources.

    In simple terms, can this rather inefficient search engine be improved in some way? Fortunately, the answer to that question is a resounding yes! As you'll possibly know, most modern database servers support the implementation of full-text and Boolean searches. These features can dramatically improve the speed of executed queries and allow users to specify the relevance of certain search terms via simple operators, such as the plus (+) and minus (-) signs, to name the most common ones.

    Of course, in this series of articles I'm going to show you how to work with full-text and Boolean searches using MySQL and PHP 5, but the entirety of the code samples that will be developed here can be easily modified to work with a different database server.

    Having introduced you to the subject of this series, it's time to move on and discover together the real power of using full-text and Boolean searches with MySQL. Let's begin now!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek