WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-17-2008, 01:12 PM
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,504
wige RepRank 4wige RepRank 4wige RepRank 4
Default Keyword Search Issue in MySQL

I am working on creating a search feature for my web site that will allow customers to search for a product based on the name of the item. The current query is basically:
Code:
SELECT * FROM products WHERE MATCH(product_name) AGAINST ('keyword');
This method allows the results to be sorted by relevance, and is faster than using LIKE or other types of operators. However, this method does not allow stemming. For example, we have a product line related to a sports team called the IronPigs. Users tend to add a space, searching for "Iron Pigs", causing items containing "IronPigs" not to come up in the results.

The only solution I have been able to find to this is using LIKE:
Code:
SELECT * FROM products WHERE product_name LIKE '%keyword%';
This causes the user to get the correct result, but it puts more load on the server, and removes my ability to sort by relevance. For example, we have hundreds of items related to the SuperBowl in the database, but "SuperBowl" itself gets lost in a search, buried under the other, less relevant results.

Is there a way to emulate or enable stemming in MySQL keyword searches, so that the database will look for the keyword within words in the specified field?
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 04:45 AM
speed speed is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 804
speed RepRank 1
Default Re: Keyword Search Issue in MySQL

Stemming does not help with the selection of "Iron Pigs" or "IronPigs" as that is 2 words or 1 word respectively.

Stemming would convert the words directory and directories to directori (may not be the correct stem but illustrates the point).

One option you have is to build a list of common miss spellings then when you get zero results compare the query term against the list and put up a message did you mean ....

Another option is to run the like query if the full text match fails, but then you still have no rank.
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory : Web Directory Script
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: index, keyword, mysql, search



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
content issue for search engine link.master Search Engine Optimization Forum 12 01-08-2008 06:15 AM
Forum Search Possible Issue wige WebProWorld: Guidelines/Announcements/Suggestions 0 05-22-2007 11:43 AM
Search Marketing Standard, New Issue incrediblehelp Search Engine Optimization Forum 8 05-16-2006 09:13 PM
Search engine issue with my site jaiye Submit Your Site For Review 8 04-04-2006 02:13 PM


Search Engine Friendly URLs by vBSEO 3.0.0