Mailing List Archive

Error in KinoSearch::InvIndexer.pm (add_doc)
Hello,

Revision 2638 is having a moan during indexing in
.../KinoSearch/InvIndexer.pm line 113. Ignore this email if you're aware
of this due to the dev version being in flux.

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

.../KinoSearch/InvIndexer.pm line 113
KinoSearch::InvIndexer::add_doc('KinoSearch::InvIndexer=HASH(0x8c93424)',
'HASH(0x8ca4560)', 'boost', 0.999192897497982) called at
/etc/test/indexer/indexer line 1035

---

/etc/test/indexer/indexer line 1035:
$invindexer->add_doc( \%doc, boost => $doc_boost );

---

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.

Regards
Henry


_______________________________________________
KinoSearch mailing list
KinoSearch@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Error in KinoSearch::InvIndexer.pm (add_doc) [ In reply to ]
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@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
Re: Error in KinoSearch::InvIndexer.pm (add_doc) [ In reply to ]
>> 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.

No problem or disruption at all. I enjoy shaking the tree to see what
falls out :-)


> Instead, change your script to look like this:
>
> $invindexer->add_doc(
> doc => \%doc,
> boost => $doc_boost
> );

ah, thanks.




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