note 37192 added to ref.com

From: Date: Thu, 06 Nov 2003 13:07:32 +0000
Subject: note 37192 added to ref.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-59987@lists.php.net to get a copy of this message
Hi, I´ve GOOGLED alot to find out how to use the MS Index Server (which comes with IIS-Webserver) as a search engine. Here is the code that makes a connection via ADO and lists a result for a given searchstring. Hope you'll find it usefull, it will surely prevent you from searching a long time in search engines. If anybody knows how to do it better, feel free to post it here. The following url contains a description for the index server. It also mentions some further features of the index server (http://www.jiafangyifang.com/memo.php?ID=3232 japanese only, sorry). $searchstring="news"; $INDEXCATALOG="YourCatalogName"; $objIndexServer = new COM("ADODB.Connection") or die("Cannot start ADO"); $objIndexServer->Provider = "msidxs"; $objIndexServer->Open($INDEXCATALOG); $sql="SELECT DocTitle, VPath, Path, Filename, Access, HitCount, Rank " ."FROM SCOPE('DEEP TRAVERSAL OF \"d:\inetpub\intranet \"') " ."WHERE ((CONTAINS(' \"$searchstring\" ') >0) " ."AND ((Path NOT LIKE '%\_vti%') AND (Path NOT LIKE '%\_private%') " ."AND (Filename NOT LIKE 'search.php'))) ORDER BY Rank DESC"; $objRS = $objIndexServer->Execute("$sql"); # submit the query while (!$rs->EOF) //create output { echo $objRS->Fields["DOCTITLE"]->value." -- " .$objRS->Fields["FILENAME"]->value." -- " .date("d.M.y",$objRS->Fields["ACCESS"]->value)." -- " .$objRS->Fields["HITCOUNT"]->value." -- " .($objRS->Fields["RANK"]->value/10)."% ----> " .$objRS->Fields["VPATH"]->value ."<br>"; $objRS->MoveNext(); } ---- Manual Page -- http://www.php.net/manual/en/ref.com.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37192 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37192&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37192&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59987) next »