|Search in a mysqldb with php||#1|
How to implement a great search within a mysqldb - within a table
if i search with '...LIke %bla%....' not all entrys would be found - if bla within a word for example.
a search with soundex would be great to - but if i read the manual i must create an soundex-index to search for soundex-values?
So the question whats the "best practice" to write a good db-search vor a keyword within a simple column "title" or someting else.
posted date: 2008-12-09 07:59:00
|Re: Search in a mysqldb with php||#3|
For text search you have two options besides using a LIKE clause - FULLTEXT index (which means using MyISAM) or using specific indexing engines such as Lucene or Sphinx.Personally I'd recommend using Sphinx, it has excellent integration with both MySQL and PHP and is very fast for text search (and other queries as well).
posted date: 2008-12-09 08:04:00
|Re: Search in a mysqldb with php||#4|
If you're not up to installing and using Sphinx, then you can try using some of MySQL's built in full text searching features like "MATCH"This lets you do full text searching and even ranks results with a relevance score. You can write queries like:
SELECT id, col1, col2, MATCH(col1, col2) AGAINST('some text' IN NATURAL LANGUAGE MODE) AS relevance FROM table1;
You can even use query expansion to pick up on other closely related terms. For example, if the user searches for "database" and the top most relevant results contain "mysql", then the mysql will also search for "mysql" because it has determined that the "mysql" term is closely related to the "database" term the user searched for.http://dev.mysql.com/doc/refman/5.1/en/fulltext-query-expansion.html
posted date: 2009-11-08 17:09:00
|select page: « 1 »|