Saturday, January 16, 2010

Smart Search

This question comes from Sean A.

Mike, do you know of any code or APIs for helping make a site's search feature more intelligent? I'm working on getting my site's search developed and I know later on as things go id like to make the search "smarter" as in it having an understanding of word relations  such as understanding that  'lumber' and 'construction" go together so fi i search for construction supplies it understands that lumber businesses are part of construction. Do you know how to go about finding a base or having something developed? I don't even know how to write the documentation for a prototype of it.

Smart searching is a pretty common problem in today's web applications. Essentially we take a typical narrow search term and broaden it a bit to include additional relevant results.

Probably the best way to accomplish this is to have a related terms table which can serve as an index for related search terms. So, using your example, 'lumber' could also be related to a search for 'construction', 'contractors', and 'carpentry'.

Behind the scenes, you would want to add these to the user's search query via OR.

SELECT foo
FROM bar
WHERE bar.keyword LIKE "%lumber%"
    OR "%construction%"
    OR "%contractors%"
    OR "%carpentry%"

No comments:

Post a Comment