Website Search Facility? Free PHP Coding?

muchacho

Supreme Member
Joined
May 14, 2009
Messages
1,294
Reaction score
189
I'm interested in designing a website, but it will need to have search facility, where people will either enter a search phrase and/or select bullet options and the results will be displayed.

As I have very very little knowledge of PHP is anything such as a universal PHP script that can edited/tweaked to work on most websites, or are they all unique?

Many thanks in advance.
 
Search systems are non-trivial. See if you can get away with using Google Site Search: http://www.google.com/sitesearch/

Either that, or prepare to install/configure a search daemon like Sphinx or Solr.
 
Search systems are non-trivial. See if you can get away with using Google Site Search: http://www.google.com/sitesearch/

The thing is voyevoda I want the search results to appear on the website in such a way that it doesn't look like a third party is being used - so that the results are cleanly displayed on the website in a professional way. I hope that makes sense?

As far as I'm aware, people will know with Google site search, that it's powered by Google and results aren't really customisable?

Take a Classified Ad website, such as Ebay ... where the results all look neat and tidy and as part of the website.
 
It can be coded easy enough, it just depends on your CMS's mysql db and table structures. If you plan to build this site from scratch all the better.

It will basically all come down to a mysql query kinda like this one
Code:
select * from articles where title like %$keyword%
but more complex most likely.

It's a lot simpler then you might imagine.
 
Sphider is a search/spider script that you can add to your site and customize - all php I think, might be what you need.
 
The esiest way method is through database queries, you can define preconfigure search specs in any way you want. However, this will affect how your database tables going to be indexed to speed up every search terms.
 
It will basically all come down to a mysql query kinda like this one
Code:
select * from articles where title like %$keyword%
but more complex most likely.

The only thing to be aware of when using this method is that it will not scale.

Since your LIKE begins with a %, indexes on your text columns will be completely ignored, resulting in a full table scan every time someone does a search. A full table scan will block other queries sharing the same socket until it's complete. MySQL's query cache will not help you here either. Your result set will be huge, so MySQL will probably be writing to disk to do queries of this nature, too.
 
Back
Top