note 37192 deleted from ref.com by danbrown

From: Date: Mon, 21 Dec 2009 17:13:45 +0000
Subject: note 37192 deleted from ref.com by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164223@lists.php.net to get a copy of this message
Note Submitter: dirk_hahn at westlb-systems dot de ---- 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(); }

« previous php.notes (#164223) next »