lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Itamar Syn-Hershko <ita...@code972.com>
Subject Re: MoreLikeThis fixes
Date Wed, 24 Dec 2014 22:56:49 GMT
Thanks, good catch. Pushed fixes for those

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>

On Wed, Dec 24, 2014 at 5:15 AM, Laimonas Simutis <laimis@gmail.com> wrote:

> While porting Classification tests noticed minor issues with MoreLikeThis
> implementation. I did not want the Classification test branch to mix in
> core class changes so pointing them out here. Can someone with master
> commit review and check-in:
>
> Issue 1:
>
> https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs#L624
>
> should be ts.AddAttribute<ICharTermAttribute>()  (note ICharTermAttribute
> and not CharTermAttribute)
>
> Java implementation uses "Impl" moniker to separate implementation from
> interface and does not use "I" prefix for the interface. So when code is
> ported over that uses CharTermAttribute in java, the meaning is to use the
> interface yet in C# CharTermAttribute is the implementation. A gotcha that
> we need to be aware of when porting I guess.
>
> There are 4 other places that call AddAttribute<CharTermAttribute>() but
> all 4 are commented out.
>
> Issue #2:
>
> https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs#L591
> and
>
> https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs#L640
>
> throws exception if dictionary value is not found. It should be something
> like this:
>
> Int cnt;
> if (!termFreqMap.TryGetValue(word, out cnt))
> {
>   termFreqMap[word] = new Int();
> }
> else
> {
>  cnt.x++;
> }
>
> Let me know if you would like me to do a PR with these changes or someone
> can commit them, if they look appropriate.
>
>
> Thank you,
>
> Laimonas
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message