File: scan_enum.plx

package info (click to toggle)
libkinosearch1-perl 1.01-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,580 kB
  • sloc: perl: 6,805; java: 168; makefile: 3
file content (36 lines) | stat: -rw-r--r-- 884 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl
use strict;
use warnings;
$|++;
 
use Time::HiRes qw( time );
use KinoSearch1::Store::FSInvIndex;
use KinoSearch1::Index::FieldInfos;
use KinoSearch1::Index::CompoundFileReader;
use KinoSearch1::Index::SegTermEnum;


my $invindex = KinoSearch1::Store::FSInvIndex->new(
    path => $ARGV[0],
);

my $cfs_reader = KinoSearch1::Index::CompoundFileReader->new(
    invindex => $invindex,
    seg_name => '_1',
);
my $finfos = KinoSearch1::Index::FieldInfos->new;
$finfos->read_infos( $cfs_reader->open_instream('_1.fnm'));

my $t0 = time;
while (1) {
    print ".";
#    1 for 1 .. 10000;
    my $instream = $cfs_reader->open_instream('_1.tis');
    my $enum = KinoSearch1::Index::SegTermEnum->new(
        finfos => $finfos,
        instream => $instream,
    );
    $enum->fill_cache();
   # 1 while defined (my $term = $enum->next);
}
print ((time - $t0) . " secs\n");