Review Site User Manual

SEARCH ENGINE

Adjust Text:  a a a a
« Table of Contents   |   Obtain Review Site »


SEARCH ENGINE

For the kind of small site that Review Site is designed to accomodate, having a search engine almost seems like overkill. But visitors expect to see search engines on all the sites they visit, so you'll find one in Review Site too. However, I have cheated somewhat and added a search engine based on the FULLTEXT search capabilities that MySQL offers. Basically that means get all the great advantages that search engines have to offer in exchange for giving up control on how the search engine works and how successfully it performs its matching.

But like I said, for a small site, having any kind of search engine at all is a bonus, so try not to turn your nose up at it.

Keyphrase Searches

I have no idea how MySQL implements its FULLTEXT searches. All I know is that one only needs to add a FULLTEXT index on string columns in the table of interest, and MySQL will use the index to locate records that match a specified key phrase. Presently I have implemented a very simple search query that is based on the FULLTEXT index. Possibly this will change in the future if I decide the search engine needs to work better.

Improving Search Results By Indexing More Columns

By default, the following text-based columns in Review Site are the ones searched when a FULLTEXT search is launched:

Article.title
Article.author
Article.summary
Article.content

Review.product_name
Review.product_summary
Review.product_description
Review.review_summary
Review.review_text

While I recommend that you don't bother changing the way the search engine works, you are nonetheless free to change which columns are used for the FULLTEXT indexing. You might decide this is necessary if you add more text-based columns to either the Article or Review tables.

To change which columns are used for the search engine visit the Database control panel and pull up the Column definition page for either the Article or Review table. You should be able to see at the bottom of the page a list of the keys that have been added to the table. In particular you will see an index named srch with a Key Type of FULLTEXT. The columns that are used in that key are also listed.

To add or remove columns from that index, click on the srch link to open up the page that allows you to edit the index. It should look something like the following:

Add a column to key srch

To ADD an indexable column to this key, select a column name from the left menu. To specify the position to insert the column, select from the right menu. The default is to add the column to the end of the existing key definition.

   

Delete a column from key srch

To DELETE one or more columns from this key, select the column name(s) from the menu on the right.
 

 

Reorder key srch

To reorder columns in this key, select one or more column names from the menu on the right. Click ++ or - - to move them higher or lower in the column definition.
 
   
 
 

As you can see, there are functions to add or delete columns from the index. You can even reorder columns in the index, but that happens to be irrelevant for FULLTEXT indexing as used in Review Site so you can ignore it.

IMPORTANT: You can only add text-based columns to a FULLTEXT index, so if you attempt to add other column types, like INTEGER or FLOAT you'll simply get an error message.


Next Section: LANDING PAGES

« Table of Contents   |   Obtain Review Site »


Copyright © 2008 Random Mouse Software. All Rights Reserved.