[KinoSearch] Misleading error on invindex open?

Marvin Humphrey marvin at rectangular.com
Fri Sep 5 06:44:18 PDT 2008


On Sep 5, 2008, at 3:16 AM, Henka wrote:

> As a matter of interest, I noticed the following error when  
> (incorrectly) opening an existing inverted index in a searcher:
>
> Couldn't _____create_____ directory /invindex at ../c_src/KinoSearch/ 
> Util/Compat/DirManip.c:26 kino_DirManip_create_dir
> at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/ 
> KinoSearch.pm line 317

> from the caller's point of view it's weird (ie, we're opening a  
> directory which contains an inverted index, not creating).

The semantics of Schema->open changed a while back, prior to the  
0.20_04 release.  What you want now is Schema->read.  From the Changes  
file:

     * KinoSearch::Schema
       o create() - Removed.
       o read() - Added.
       o open() - Behavior changed -- now creates an index if none  
detected.

This was a confusing change, no doubt, and I'm sorry it snared you.   
If Schema->open had ever appeared in a stable release, modifying it  
wouldn't have been an option, but since it only affected devel, I went  
with what I thought was the best API ex nihilo.  The change wasn't  
dangerous to any existing scripts (invalid read locations would have  
already been detected and debugged), so the only drawback was that an  
early devel-branch user might not notice the API mod and expect the  
old behavior when writing a new script.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

***************************************************************************
 From Schema's POD:
***************************************************************************

=head2 clobber

     my $invindex = MySchema->clobber('/path/to/invindex');
     my $invindex = $schema->clobber('/path/to/invindex');

Create a directory and initialize a new invindex at the specified  
location.
If the specified directory already exists, first attempt to delete any  
files
within it that look like index files.

=head2 open

     my $invindex = MySchema->open('/path/to/invindex');
     my $invindex = $schema->open('/path/to/invindex');

Open an invindex for reading/writing, creating a new one if needed.   
All fields
which have ever been defined for this invindex will be added/verified  
via
add_field().

=head2 read

     my $invindex = MySchema->read('/path/to/invindex');
     my $invindex = $schema->read('/path/to/invindex');

Open an invindex for either reading or updating.  Fail if the invindex  
doesn't
exist.  All fields which have ever been defined for this invindex will  
be
added/verified via add_field().





More information about the kinosearch mailing list