2

I want to build a product-search engine.

I was thinking of using google-site-search but that really searches Google's index of your site. I do not want to search that. I want to search a specific table (all the fields, even ones the user never sees) on my data-base for given keywords.

But I want this search to be as robust as possible, I was wondering if there was something already out there I could use? if not whats the best way to go about making it myself?

JD Isaacks
  • 56,088
  • 93
  • 276
  • 422

5 Answers5

6

You can try using Sphinx full-text search for MySQL.

Here's also a tutorial from IBM using PHP.

the_void
  • 5,512
  • 2
  • 28
  • 34
  • Sphinx is really fast on both ends (indexing and searching). Definitely worth looking into. – Ariel Jun 21 '10 at 21:52
  • Not to mention `Sphinx` would also solve your other issue: http://stackoverflow.com/questions/3088433/sql-plural-singular-searches – the_void Jun 21 '10 at 21:57
  • Thanks, I tried to install sphinx, but I guess I am too novice a linux user to know what I am doing, just about every other step gave me some error that I had no clue what it meant or what to do. – JD Isaacks Jun 22 '10 at 18:17
  • Tutorials: http://acidborg.wordpress.com/2009/11/22/how-to-install-and-configure-sphinx-in-ubuntu-9-10-with-mysql-support/ http://pkarl.com/articles/guide-django-full-text-search-sphinx-and-django-sp/ – the_void Jun 22 '10 at 22:29
  • Thanks, i'll try my best to figure it out now, if not i'll come back to it once I get a little more linux experience under my belt. – JD Isaacks Jun 23 '10 at 13:08
2

I'd focus on MySQL Full-Text search first. Take a look at these links:

Here is a snippet from the first link:

Full-text searching is performed using MATCH() ... AGAINST syntax. MATCH() takes a comma-separated list that names the columns to be searched. AGAINST takes a string to search for, and an optional modifier that indicates what type of search to perform. The search string must be a literal string, not a variable or a column name. There are three types of full-text searches:

Abe Miessler
  • 82,532
  • 99
  • 305
  • 486
1

As far as stuff that's already out there, take a look at these :

Community
  • 1
  • 1
JohnB
  • 18,046
  • 16
  • 98
  • 110
1

SELECT * FROM table WHERE value REGEXP 'searchterm'

Allows you to use many familiar search tricks such as +, "", etc

This is a native function of MySQL. No need to use go to a new language or plugin which might be faster, but is also extra time for maintenance, troubleshooting, etc.

It may be a little slower than doing some crazy C++ based mashup, but users don't generally notice a difference between milliseconds......

bpeterson76
  • 12,918
  • 5
  • 49
  • 82
1

One thing you might also want to look into (if you're not going to utilize sphinx), is stemming your keywords. It will make matching keywords a bit easier (as stemming 'cheese' and 'cheesy' would end up producing the same stemmed word) which makes your keyword matching a bit more flexible.

cmendoza
  • 296
  • 1
  • 4