Subject: | SetFilePointerEx() fails during commit. |
Get an error when calling commit on Indexer:
SetFilePointerEx to 0 on c:\temp\search.index\seg_1\cfmeta.json failed:
The handle is invalid., SI_read_bytes at
core/KinoSearch/Store/InStream.c line 267
at /usr/lib/perl5/site_perl/5.10/i686-cygwin/KinoSearch.pm line 486
KinoSearch::Util::Json::slurp_json('KinoSearch::Util::Json',
'folder', 'KinoSearch::Store::FSFolder=SCALAR(0x1b418d8)', 'filename',
'seg_1\cfmeta.json')
called at test.pl line 58
----
The last part of the error message can vary depending (after
Note: This is part of a bigger project that used to run ok on 0.156, but
I've had trouble since trying to port to 0.30_072. I had to make some
changes.
Perl version: v5.10.1
Weird stuff: I am running on Vista using CYGWIN 1.7. The KinoSearch
0.156 runs ok.
Subject: | test.pl |
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec;
use File::Basename;
use Date::Format;
use Date::Parse;
use KinoSearch::Indexer;
use KinoSearch::Analysis::PolyAnalyzer;
my $source_dir = 'c:/temp/';
my $path_to_invindex = 'c:/temp/search.index';
my $base_url = '/';
opendir( my $source_dh, $source_dir )
or die "Couldn't opendir '$source_dir': $!";
my @filenames = grep {/\.txt/} readdir $source_dh;
closedir $source_dh or die "Couldn't closedir '$source_dir': $!";
### STEP 1: Choose an Analyzer.
my $analyzer = KinoSearch::Analysis::PolyAnalyzer->new(
language => 'en',
);
my $schema = KinoSearch::Schema->new;
my $type = KinoSearch::FieldType::FullTextType->new(
analyzer => $analyzer,
);
$schema->spec_field( name => 'domain',
type => $type );
$schema->spec_field( name => 'url',
type => $type );
my $invindexer = KinoSearch::Indexer->new(
schema => $schema,
index => $path_to_invindex,
create => 1,
truncate => 1,
);
my $doc = KinoSearch::Doc->new(
fields => { domain => '', url=>''}
);
$doc->{ domain } = "test";
$doc->{ url } = "zzz";
$invindexer->add_doc($doc);
$invindexer->commit; # Fails here.