[KinoSearch] clobber, open, read

Marvin Humphrey marvin at rectangular.com
Wed Jun 20 16:58:33 PDT 2007


Greets,

While working on an expanded Tutorial, I had occasion to reconsider  
the InvIndex constructors and their corresponding factory methods in  
Schema.

It occurred to me that...

   * create() was not very useful.
   * We needed a variant with these semantics: "open an index if
     one exists, otherwise create a new one".

So, the following changes have been made.

   * create() has been zapped.
   * The behavior of open() has changed slightly.  It used to throw
     an error if it couldn't find an index; now it will create a
     new one instead.
   * A new method, read(), has been added.  It behaves exactly like
     open() used to.

Existing indexing applications only need change if they are using  
create().

Existing search applications need not change unless they're doing  
something esoteric like catching the error thrown by open().

New search applications should prefer read() over open() as it will  
throw an appropriate error when supplied with an invalid index location.

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

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





More information about the KinoSearch mailing list