On Aug 17, 2007, at 10:14 AM, Scott Beck wrote:
> Is there a reason it isn't possible to create a new
IndexReader on an
> empty index?
There are two scenarios that could be described as
"empty index".
The first is the one that is likely to be an incorrectly
specified
filepath: either the directory exists but there aren't any
index
files in it, or the index directory doesn't exist. Trying
to create
an IndexReader against such a filepath should throw an
exception, in
keeping with the anti-typo parameter validation strategy
deployed
throughout the KS code base.
The second is that index files are present, but no documents
have
been added. In this case, the behavior ought to be an empty
but
valid IndexReader. However, that is not currently the case.
This
code produces an error:
my $invindexer = KinoSearch::InvIndexer->new(
invindex =>
USConSchema->clobber('dummy_index') );
$invindexer->finish;
my $reader = KinoSearch::Index::IndexReader->open(
invindex => USConSchema->open('dummy_index')
);
print "Max doc: " . $reader->max_doc .
"n";
The problem is that InvIndexer->finish declines to change
the index
if nothing has happened, so we end up with only the starter
file and
not a complete set of index files. I believe this is the
error you
encountered, based on the line number you reported.
If that were fixed, would it solve your current problem?
> Also, on a side note, the docs here:
> http://www.rectangular.com/kinosearch/docs/dev
el/KinoSearch/Store/
> LockFactory.html
> say to use KinoSearch::Index::IndexReader->new(),
not ->open(), but
> that gives an error.
Thank you for catching that. Fixed by revision 2494.
Marvin Humphrey
Rectangular Research
http://www.rectangular.co
m/
_______________________________________________
KinoSearch mailing list
KinoSearch rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
|