Mailing List Archive

Misleading error on invindex open?
Greetings,

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

Probably just a semantic thing, since in the DirManip context (I
didn't go digging too deep) it probably makes sense, but from the
caller's point of view it's weird (ie, we're opening a directory which
contains an inverted index, not creating).

...or am I just light-headed because it's almost the weekend...

Cheers!
Henry


_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Misleading error on invindex open? [ In reply to ]
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().



_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Misleading error on invindex open? [ In reply to ]
Quoting "Marvin Humphrey" <marvin@rectangular.com>:
> This was a confusing change, no doubt, and I'm sorry it snared you.

Cool, thanks for the prompt response.

Regards
Henry


_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Misleading error on invindex open? [ In reply to ]
Quoting "Marvin Humphrey" <marvin@rectangular.com>:
> 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:

I think what really snared me was the implied "create" when using a
*Searcher*, not indexer.

Regards
Henry


_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Misleading error on invindex open? [ In reply to ]
On Sep 5, 2008, at 7:20 AM, Henka wrote:

> I think what really snared me was the implied "create" when using a
> *Searcher*, not indexer.

I agree that it would be nice to force 'read' when opening a Searcher,
but it can't be helped -- the error occurs before the Searcher
constructor is entered.

my $searcher = KinoSearch::Searcher->new(
invindex => MySchema->open('/path/to/invindex'),
);

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


_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch