Search Bar

Discussion in 'PHP' started by oo7ml, Jan 14, 2008.

  1. #1
    Hi, i am designing a new site and i want to add a search bar to the site so users can search my site.

    I do not want to use other search utilities such as a google search bar. I want to add my own search bar that will search my site.

    Can someone please point me in the right direction please
     
    oo7ml, Jan 14, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your site content is in a daatabase, you can write a search engine that queries the database fro your content.
     
    matthewrobertbell, Jan 14, 2008 IP
  3. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    No, it does not have a database, is there a way to create this without having a database
     
    oo7ml, Jan 14, 2008 IP
  4. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You will need some sort of database to store the search index, unless your site is very small. If it's just a handful of pages, you can build an index and store it in a flat file. This will not scale well though.
     
    SmallPotatoes, Jan 14, 2008 IP
  5. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Ok, cool, thanks
     
    oo7ml, Jan 14, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #6
    It won't work out, as you'd have to store each individual keyword, and update it as your pages change. Its easier to use something like freefind.com

    If you want to do that way, I suggest moving all your content to a database, and then writing a S.E. based on that. That will work, a few explode() statements to cut sentences and you're there. Just use a (My)SQL query like:

    SELECT * FROM `content` WHERE `body` LIKE '%keyword%'
    (untested)

    Jay
     
    jayshah, Jan 14, 2008 IP
  7. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #7
    Ok, thanks for your feedback
     
    oo7ml, Jan 14, 2008 IP
  8. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #8
    shallowink, Jan 14, 2008 IP
  9. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #9
    Wow, thanks
     
    oo7ml, Jan 14, 2008 IP
  10. LimeBlast

    LimeBlast Peon

    Messages:
    81
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Maybe you can find this at hotscripts.com
     
    LimeBlast, Mar 23, 2008 IP