tags:

views:

54

answers:

2
+2  Q: 

search a database

Let's say I have a large database with product information. I want to create a search engine for that database, preferably with indexing and autocorrect features. How do I go about doing this? Are there any good libraries I could use, so that I don't have to start from scratch with basic SQL? Just some basic recommendations, links, would be much appreciated.

I am familiar with PHP, C#, VB, and Java, but I know very little about databases.

A: 

If your product database creates web pages, you would be best served using lucene or htdig. Those will do really good text searching based on your content.

Otherwise you will want to search the large fields of your database using the full text search capabilities in mysql.

To do the autocomplete you will need to have an offline indexing process that works similarly to google. Create another table called wordIndex. It contains words and the number of occurrences in your product db.

When a user starts to type, you do an ajax lookup on this table and autocomplete based on that.

Byron Whitlock
A: 

If mySQL FULLTEXT searching doesn't do all you need it to (databases have indexes of their own you can set up), two good choices are Solr (based on Lucene) and Sphinx. Both are often used to provide a full featured search index on top of a mySQL database. Here's a comparison of the two.

mxyzplk