1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Website Search Facility? Free PHP Coding?

Discussion in 'PHP & Perl' started by muchacho, Apr 8, 2010.

  1. muchacho

    muchacho Supreme Member

    Joined:
    May 14, 2009
    Messages:
    1,293
    Likes Received:
    187
    Location:
    Lancashire, England.
    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.
     
  2. voyevoda

    voyevoda Regular Member Premium Member

    Joined:
    Mar 21, 2010
    Messages:
    217
    Likes Received:
    97
    Location:
    Eastern Front
    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.
     
  3. muchacho

    muchacho Supreme Member

    Joined:
    May 14, 2009
    Messages:
    1,293
    Likes Received:
    187
    Location:
    Lancashire, England.
    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.
     
  4. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    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.
     
  5. hardcore1

    hardcore1 Junior Member

    Joined:
    Jan 31, 2010
    Messages:
    160
    Likes Received:
    30
    Occupation:
    Ranking on Google
    Location:
    UK
    Sphider is a search/spider script that you can add to your site and customize - all php I think, might be what you need.
     
  6. origin

    origin Regular Member

    Joined:
    Nov 11, 2008
    Messages:
    334
    Likes Received:
    90
    Home Page:
    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.
     
  7. voyevoda

    voyevoda Regular Member Premium Member

    Joined:
    Mar 21, 2010
    Messages:
    217
    Likes Received:
    97
    Location:
    Eastern Front
    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.