Build a Smarter Search Engine

By Deane Barker on September 4, 2002

Build a Smarter Search Engine: This is an article from JavaPro magazine about building a Case Based Reasoning (CBR) search engine:

“A man walks into a car dealership and tells the salesperson about his perfect car. It would be red, have four doors, a large trunk, 300 horsepower, side airbags, four wheel drive, and would cost $20,000. Knowing his perfect car probably doesn’t exist, he asks the dealer to show him the car that is closest to what he described. It doesn’t have to be an exact match, it just has to be close.”

Here’s a crude, thumbnail sketch: say a user has two criteria, A and B. The user gives each one a value of between 1 and 10, and we map this on a Cartesian scale (X and Y axis). Then the search engine goes to work, mapping each possible result on the same scale, then using the Pythagorean theorum to determine which possible result is closest geometrically (as the crow flies) to the user’s criteria. Maybe one will be right on their criteria, but, if not, the user will have a list of possible results from closest to furthest from what they want.

The first half of the article is theory, while the second half is how to implement it using Java and SQL. If you’re not a programmer, skip the last half.

Gadgetopia