SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple PHP search engine for my site

    I finished a website without a search engine facility for it (signature for details).

    I want to develop that facility.
    I have all my pages STATIC on the server, and using php i would like to build a simple search for my site.

    I made something but the respons time is not so good using the database (huge databse), so that's why i would like to use my static pages.

    Any help is appreciate.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    You have STATIC pages and the info in a batabase?!

    Ok well that confuses me slightly.
    Do you mean you have something like: http://www.lyricsrec.com/lyrics/cassie-steele/index.php and on that page a query to pull the records out?
    or that each page has the lyrics hardcoded onto them?

    You mention that you wrote something already, can you post it?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the lyrics in database and also on static pages.

    I have this code now
    Code:
    $resulttsearch22=mysql("db_name","select ID,Text from lyrics");
    $num_cautari2=mysql_num_rows($resulttsearch22);
    for ($c=0;$c<$num_cautari2;$c++)
    {
    $relevancy=0;
    $row=mysql_fetch_object($resulttsearch22);
    $mypage=$row->ID;
    $mycontent=strtolower(strip_tags($row->Text)); 
    for ($d=0; $d<$q_num; $d++)
    {$liungimeasasa=strlen($q_array[$d]);
    if ($liungimeasasa>2) 
    {
    $mycontent=substr($mycontent, 0,1000);
    $relevancy+=substr_count($mycontent, strtolower($q_array[$d]));
    }
    }//end of for
    if ($relevancy>0)
    $res["$mypage"]=$relevancy; 
    if (count($res)>0)
    arsort ($res);
    
    }

  4. #4
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So nobody can go on from there?

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    >I made something but the respons time is not so good using the database (huge databse), so that's why i would like to use my static pages.

    I'd do yourself a favour and take a look at how mysql's FULLTEXT search works before damning your database as slow.

  6. #6
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If MySQL's built-in full-text search doesn't work well in your case, you might want to have a look at: mnoGoSearch and Sphinx.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •