[KinoSearch] Error in KinoSearch::InvIndexer.pm (add_doc)

Marvin Humphrey marvin at rectangular.com
Tue Nov 13 08:55:43 PST 2007




On Nov 12, 2007, at 11:27 PM, Henry wrote:

> Parameter error: odd number of args at /etc/test/indexer/indexer

> $invindexer->add_doc( \%doc, boost => $doc_boost );

Sorry about the disruption.  I changed this API recently.

I'm working towards bringing DocWriter, PostingsWriter, LexWriter,  
and TermVectorsWriter (until it gets zapped) all under the same  
abstract parent class: the as-yet-to-be-committed  
KinoSearch::Index::Writer.  Writer's add_doc() method takes labeled  
params, and InvIndexer::add_doc should be compatible.   
InvIndexer::add_doc's signature was unique in all of KS -- no other  
method took a single required arg *followed* by labeled options.   
Better to bring it into line with all the rest.

> If I change add_doc() in .../KinoSearch/InvIndexer.pm:
>
> --- InvIndexer.pm        2007-11-13 09:23:20.000000000 +0200
> +++
> /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/KinoSearch/ 
> InvIndexer.pm
>     2007-11-13 09:09:35.000000000 +0200
> @@ -106,7 +106,7 @@
>  sub add_doc {
>      my $self = shift;
>      my %args;
> -    if ( @_ == 1 ) {
> +    if ( @_ == 3 ) {
>          %args = ( %add_doc_args, doc => $_[0] );
>      }
>      else {
>
>
> Then indexing *appears* to succeed.  I say *appears* since the  
> index file
> format has changed and I don't know what a healthy index (or group of)
> file looks like (lots of seg_*.(p|lex.) etc files) - even after  
> optimize.

That's not the best solution, because it's now ignoring the value you  
supplied for boost.  Instead, change your script to look like this:

    $invindexer->add_doc(
      doc   => \%doc,
      boost => $doc_boost
    );

Alternatively, go with 0.20_05 until the file format churn currently  
in progress has calmed.  That was really what I intended by not  
committing the "docs start at 1 instead of 0" patch until after that  
0.20_05 was released.  I'm sensitive to the backwards compatibility  
issues faced by KS early adopters too.  :)

There will be another release relatively soon, but if all goes as  
planned it will be a small patch to 0.20_05 to fix the apparent  
ANDScorer bug reported by Adam, rather than a snapshot of the rapidly  
evolving svn trunk.

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



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




More information about the kinosearch mailing list