note: i never said this was an optimal solution; i just said thats what ive seen. obviously i havent worked on any major search engine to date. in fact i was fishing a bit for some info on how to do it right.
On 7/5/07, Robert Cummings < robert@xxxxxxxxxxxxx> wrote: If you need to use MySQL use the MATCH AGAINST syntax since it will index the data and search much faster. I've heard tell it sucks beyond a certain size, but it's great for quick solutions and moderate sized data. If you need something more powerful look into something like Lucene.
thanks Robert, -nathan On 7/5/07, Robert Cummings < robert@xxxxxxxxxxxxx> wrote:
On Thu, 2007-07-05 at 22:26 -0400, Nathan Nobbe wrote: > Kevin, > > just like Daniel said, > > $sql .= "OR product_description *LIKE '%".$terms."%'"*; > > most of the *search engines* ive seen revolve around the use of the LIKE > construct< http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html#operator_like > > which is a simplified regex mechanism for an SQL query [for MySQL at least, > probly other RDBMS' as well] Don't do that. Unless you have a teency weency set of data don't use LIKE syntax to match data. It's extremely inefficient and requires scanning the entire table. If you need to use MySQL use the MATCH AGAINST syntax since it will index the data and search much faster. I've heard tell it sucks beyond a certain size, but it's great for quick solutions and moderate sized data. If you need something more powerful look into something like Lucene. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'