FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Search Script

 


NG
does any one no where i can get a search script tht looks for stuff on my site they looked for you can see one on www.runehq.com in the item database
deepak
There is a very powerful search engine in PHP+MySQL .. its called "TSEP" search about it.
edgarinvillegas
One non-optimal solution could be:

SELECT * FROM table
WHERE searchField1 LIKE '%searchText1%'
AND searchField2 LIKE '%searchText2%'

It does its job, but is relativly slow, and de searchText must be the exact phrase to search. If your database isnt big, you could use this.

But the optimal solution is a FULLTEXT index, MySql developed it right for this purposes: search.

Once you have created your table, you have to create a FULLTEXT index envolving all the fields you want to be in the search.

Then, while writing the query, you have to use MATCHCASE for doing it.
edgarinvillegas
Hi, it's me again.
Here I have the explanation for doing searches with FULLTEXT and MATCHTEXT (in PHP and Mysql).
It's been extracted from programacion.com.

To create the index:
ALTER TABLE ARTICULOS ADD FULLTEXT(TITULO, DESARROLLO);

To do the query:
SELECT * , MATCH (TITULO,DESARROLLO) AGAINST ('$busqueda') AS puntuacion
FROM ARTICULOS WHERE MATCH (TITULO, DESARROLLO) AGAINST ('$busqueda')
ORDER BY puntuacion DESC LIMIT 50
The result is scoring for the words searched, more score, more exact the search.

This searches quickly!!
NG
thxn this really helped me Very Happy
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.