SunQuest
           Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 21st, 2003, 08:55 PM
liaaam liaaam is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 9 liaaam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Search Engine

I am in need of building a search engine for a intranet. I would have worked it out myself given more time, unfortunatly I have limited time < 7 days so if anyone could point me in the right direction it would be appreicated. Searching would be performed on client data (ie: Name, Email, Phone, Address, Last contact, etc)

Thanks
liaaam

Reply With Quote
  #2  
Old January 22nd, 2003, 01:20 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Search Engine

search the database with the using the LIKE clause:

select * from database where name LIKE '%something%'

or you could use MySQL's fulltext searching if you are using MySQL...


Reply With Quote
  #3  
Old January 23rd, 2003, 08:20 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Search Engine

I used this select query to search within the table that contains ULRs (fields: url, title, keywords, description, name_category).

Example of query if search word is 'hobby'

Select
IF(POSITION('hobby' IN CONCAT_WS('',url,title,keywords,description, name_category)),1,0), id, name_category as cat, url, title, description, id_category
from urls
WHERE CONCAT_WS('',url,title,keywords,description, name_category) LIKE '%hobby%' ORDER BY 1 desc, cat desc,title

This select I create dinamycally regarding amount of search words.
I tried this select on table with 30 000 records, and it works fast.

Reply With Quote
  #4  
Old January 27th, 2003, 04:01 PM
jonathen jonathen is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Essex, UK
Posts: 44 jonathen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Search Engine

I use the following script - obviously you will need to change the fields to reflect your own, but it works well:

php Code:
Original - php Code
  1.  
  2. <?php
  3.  if ($search)   // perform search only if a string was entered.
  4.    {
  5.     mysql_connect("localhost","user","pass") or die ("Problem connecting to Database");
  6.     mysql_select_db("mydb") or die( "Unable to select database");
  7.     $srch="%".$search."%";
  8.        $query = "SELECT * from mytable WHERE name LIKE '$srch' || address  LIKE '$srch' || link LIKE '$srch' || website LIKE '$srch' || email  LIKE '$srch' ORDER by name DESC";
  9.  
  10.     $result = mysql_db_query("mydb", $query)
  11. or print ">>> MySQL-Error: ".mysql_errno()." -> ".mysql_error()."<br>n";
  12.  
  13.     if(mysql_num_rows($result) <= 0){
  14.         echo "Sorry - no matches were found. Please <a href="search.php">go back</a> and try some different search terms.";
  15.  
  16. } else {
  17.    
  18.     echo "Search Results:";
  19.  
  20.         while ($r = mysql_fetch_array($result)) {     // Begin while
  21.    $company = $r["name"]
  22.    $address = $r["address"];   
  23.    $link = $r["link"];   
  24.    $website = $r["website"]
  25.    $email = $r["email"];     
  26. echo "<table width="65%" border="1" cellspacing="0" cellpadding="3" bordercolor="#ABABAB">";
  27. echo "<tr>";
  28. echo "<td">";
  29. echo "$name<br>";
  30. echo "$address<br>";
  31. echo "$link<br>";
  32. echo "$website<br>";
  33. echo "$email<br>";
  34. echo "</td>";
  35. echo "</tr>";
  36. echo "<br>";
  37.         }                  // end while
  38. echo "</table>";
  39. echo "<br>";
  40. }
  41.    } else {
  42.    echo "You did not enter anything to search for. Please <a href="search.php">go back</a> and enter a search word.
  43.  
  44. ?>



Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Search Engine


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway