Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

site search tool

Status
Not open for further replies.

DotNetGnat

Programmer
Mar 10, 2005
5,548
IN
Guys,

I am planning to put a site search function for my website(built using php and mysql). Can someone point me to free source code or tools that I can use.

In the mean time I will search for the same on google...

thanks in advance.

-DNG
 
Exactly what are you planning on searching? a DB with keywords, a flat file, the actual content on the pgaes?

Answering that will narrow down what you might want to look into. If you don't have a DB its pointless to link you to a DB based search facility.

Explain a bit more how you want the search to function, and maybe we can help.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
thanks for the reply. I was hoping to create a search functionality on my site using which the users can search contents or links on my website. its like any other website search function that many sites use...

for example if you go to
they have a search box to the right and when searched brings the results with score...

i am looking for something similar...

-DNG
 
Sorry, i guess I missed the mysql part.
In that case, you plan on having a table with keywords?

And then have the search look for those keywords. the more keywords it finds associated with the particular hit, the higher up in the results it would appear.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I guess i did not understand your suggestion. I can create a new table in the database that can hold the keywords...but how am i going to populate it...

can you please elaborate a little bit...

-DNG
 
You still haven't told us what it is your are searching? the site you linked to searches for article, each article has certain keywords associated with it i take it. Or the title is what is searched, you can even search the contents of the articles if you wish.

All that information is held in a DB and searched using
as Full Text Searching.

Of course you would need to create the titles or words to search for in the DB manually.









----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
If your content is within a MySQL table you can use MySQL's own searching ability by including LIKE and/or MATCH clauses into your SQL.

MATCH only works on FULLTEXT columns, but returns a relevancy score that you can use to order the results.

Look here:

The search form (and the category links for that matter) simply cause a SELECT query to be run on the treatments table in my database. The result of this query is then processed and output.

That particular script uses MATCH on 3 different columns in the table (the treatment name, the treatment description text and an arbitrary keywords column). The results are then ordered by their relevancy score - so in theory at least the most relevant result will show first.

So...
1. think about how you want to search your content and where that content is stored.

2. Research MATCH and LIKE

3. Formulate a query that gets the data you want out of your tables

4. Write a script to execute that query and display the results

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top