In consonance with the concepts deployed in the previous section, I'm going to set up an example where all the PHP classes defined earlier will be used in conjunction to make this search engine work as expected. In this case, I'm going to use a simple "USERS" MySQL database table, populated with some basic records to illustrate the functionality of the search engine in question. It's quite possible, however, that in a real situation you'll need to perform the pertinent search queries against multiple tables. Okay, assuming that the aforementioned "USERS" table is the same one that I used in the first article of the series, it is filled in with the following data:
Here's a basic example that demonstrates how this extensible search application functions: try{ As shown above, putting the search engine to work is a fairly easy process. It requires only using all the classes that were previously defined, in addition to performing the respective search queries by taking advantage of the full-text and Boolean capabilities offered by MySQL. Finally, take a look at the following screen shots. They show the different database results returned by the search engine, according to certain search strings entered in the corresponding web form: (results returned by entering the search string "Alejandro")
(results returned by entering the search string "Alejandro+Susan")
(results returned by entering the search string "Alejandro+Susan+John")
As you can see in the previous images, building a search engine using the powerful MySQL/PHP 5 combination is indeed a no-brainer process that can be tackled with minor hassles. At this point, you have at your disposal all the required source files to incorporate this application into your own web site, and provide users with a simple mechanism to search and find your nicely-crafted contents. Final thoughts Unfortunately, this is the end of the series. Nonetheless, I think that the whole experience has been educational, since it illustrated in a friendly fashion how to build an expandable search engine by using the capabilities provided by MySQL and PHP 5. See you in the next PHP tutorial!
blog comments powered by Disqus |