PHP Classes
Icontem

File: phpIndexer.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Cesar D. Rodas  >  Guaranix Full Text  >  phpIndexer.php  
File: phpIndexer.php
Role: Example script
Content type: text/plain
Description: Test of indexing file
Class: Guaranix Full Text
Index text documents for full text searching
 

Contents

Class file image Download
<?php

/***************************************************************************
 *   Copyright (C) 2006 by Cesar Rodas   *
 *   saddor@gmail.com   *
 *                                                                         *
 *   Permission is hereby granted, free of charge, to any person obtaining *
 *   a copy of this software and associated documentation files (the       *
 *   "Software"), to deal in the Software without restriction, including   *
 *   without limitation the rights to use, copy, modify, merge, publish,   *
 *   distribute, sublicense, and/or sell copies of the Software, and to    *
 *   permit persons to whom the Software is furnished to do so, subject to *
 *   the following conditions:                                             *
 *                                                                         *
 *   The above copyright notice and this permission notice shall be        *
 *   included in all copies or substantial portions of the Software.       *
 *                                                                         *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
 ***************************************************************************/


include "gnix.php";
set_time_limit(0);
error_reporting(E_ALL);




/*
$gnix = new Gnix(array("db" => "test.db"),SQLITE);
$gnix->install();
for($i=0; $i < 20; $i++) {
$texto['file'] = "cesar rodas es el mejor de todos";
$texto['body'] = strip_tags(file_get_contents( "index/Instalar.txt"));
$gnix->Index($texto);
}*/


$connstring = array("db" => "phpgnix""host" => "localhost""user" => "root""pass" => "");
$gnix = new Gnix($connstring,MYSQL);
$gnix->install(); /* Install Just for the first time.. */


$t microtime_float();
$folder opendir("index"); /* This will index all what is in the folder INDEX(it must exist) */
while( $entry readdir($folder))
{
    if (
$entry == "." || $entry == "..")
        continue;
    print 
$entry."<br>";
    
$texto['file'] = $entry;
    
$texto['body'] = strip_tags(file_get_contents"index/".$entry));
    
$gnix->Index($texto);
    unset(
$texto);

}
$t microtime_float()- $t;
print 
"Done in ".$t." seconds";

?> 

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products