[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/bin/openfts/ -> init.pl (source)

   1  #!/usr/bin/perl
   2  #Example of init new data base
   3  use strict;
   4  use Search::OpenFTS::Index;
   5  use DBI();
   6  use DBD::Pg();
   7  
   8  if ( $#ARGV ) {
   9      print "Usage:\n$0 DATABASE\nIt need to add to postgres contrib/intarray";
  10      exit;
  11  }
  12  
  13  my $dbi =DBI->connect('DBI:Pg:dbname='.$ARGV[0]);
  14  $dbi || die;
  15  
  16  $dbi->do("create table txt ( tid int not null primary key, txt varchar, fts_index int[] );") || die;
  17  
  18  {
  19  my $idx=Search::OpenFTS::Index->init( 
  20      dbi=>$dbi, 
  21      txttid=>'txt.tid',
  22      use_index_table=>1,
  23      use_index_array=>'fts_index',
  24          numbergroup=>10,
  25      ignore_id_index=>[ qw( 13 14 12 ) ],
  26      ignore_headline=>[ qw(13 15 16 17 5) ],
  27      map=>'{ \'19\'=>[1], 18=>[1], 8=>[1], 7=>[1], 6=>[1], 5=>[1], 4=>[1], }',
  28          dict=>[
  29                  'Search::OpenFTS::Dict::PorterEng',
  30                  'Search::OpenFTS::Dict::UnknownDict',
  31      ] 
  32  );
  33  die "QQQ: $@" if ! $idx;
  34  
  35      #here we can index files by $idx->index;
  36      #it must be speedy, becouse table indexes not be created yet
  37  
  38  $idx->create_index; #this function called automatically when destroy object $idx 
  39  }
  40  $dbi->disconnect;
  41  


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7