Mailing List Archive

Another error
Hi Marvin. I was doing some work after a bit of a delay on our KS stuff,
and I remembered this problem and just went ahead and added the fix,
including a single test. You may want to add some comments and make the
test better, and check the implementation for SegLexicon. I think I got
everything you mentioned. Patch attached.

--Chris


At 16:17 -0700 2007.06.21, Marvin Humphrey wrote:
>On Jun 21, 2007, at 3:25 PM, Chris Nandor wrote:
>
>> Can't locate object method "get_size" via package
>> "KinoSearch::Index::MultiLexicon" at
>> /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/KinoSearch/
>> Search/RangeFilter.pm
>> line 159, <GEN0> line 1.
>
>Mmf. OK, no big deal. This is much easier to solve than the last
>one you threw my way. :)
>
>A Lexicon's "size" is the number of terms it holds. We can't know
>the size of a MultiLexicon until we've iterated over the entire thing
>once. We can know the number of terms each SegLexicon in the
>MultiLexicon holds, but we don't know how many terms overlap. The
>iterator uses a PriorityQueue which checks for duplicates, though, so
>if we start at the top and count how many times Lex_Next
>(multi_lexicon) returns true, we have the size.
>
>Fortunately, by this point, we'll have already performed that
>iteration -- during the call to build_sort_cache. What we need to do
>is add a self->size member var to the MultiLexicon struct, then set
>it to self->term_num as soon as the iteration finishes in
>MultiLex_build_sort_cache.
>
>The actual accessor will look like this:
>
> i32_t
> MultiLex_get_size(MultiLexicon *self)
> {
> if (self->lex_cache == NULL)
> CONFESS("Can't call MultiLex_Size unless cache filled");
> return self->size;
> }
>
>We should add a Lex_Get_Size abstract accessor to Lexicon.c/h, along
>with an XS hook in Lexicon.pm which both SegLexicon and MultiLexicon
>will inherit. We should zap the current XS hook in SegLexicon.pm and
>replace it with an implementation of Lex_Get_Size in SegLexicon.c/h.
>
>I have a deadline tomorrow, so I don't think I'll get to adding this
>code and the accompanying tests before the weekend.
>
>Marvin Humphrey
>Rectangular Research
>http://www.rectangular.com/

--
Chris Nandor pudge@pobox.com http://pudge.net/
Slashdot / SourceForge pudge@slashdot.org http://slashdot.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getsize-patch.txt
Type: application/octet-stream
Size: 5160 bytes
Desc: not available
Url : http://www.rectangular.com/pipermail/kinosearch/attachments/20070806/36acd5a3/getsize-patch.obj
Re: Another error [ In reply to ]
On Aug 6, 2007, at 10:42 PM, Chris Nandor wrote:

> I was doing some work after a bit of a delay on our KS stuff,
> and I remembered this problem and just went ahead and added the fix,
> including a single test. You may want to add some comments and
> make the
> test better, and check the implementation for SegLexicon. I think
> I got
> everything you mentioned. Patch attached.

I committed this patch verbatim shortly after you supplied it to the
list. Thanks!

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



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