lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Lauwers <Jeroen.Lauw...@CTLO.NET>
Subject RE: Exception thrown in MultiPhraseQuery.ExtractTerms
Date Fri, 12 Sep 2008 07:29:34 GMT
TJK,

Thank for that note. (I like that fix better too).

I never realized that setting the value of a key that doesn't exist would create a new one.
Good to know.

Thanks,
Jeroen

-----Original Message-----
From: Doug Sale [mailto:dougsale@gmail.com]
Sent: donderdag 11 september 2008 21:17
To: lucene-net-dev@incubator.apache.org
Subject: Re: Exception thrown in MultiPhraseQuery.ExtractTerms

TJK,

I like your fix better ;]

And, yes, the "== false" garbage is a leftover from the VS JLCA (I
believe).  I'll make a note to change these - or feel free to submit a
patch.

Thanks,
Doug

On Thu, Sep 11, 2008 at 2:05 PM, TJ Kolev <tjkolev@gmail.com> wrote:

> Hello!
>
> This has been a bug since 1.9. The way I fixed it is like this:
>
>    terms[arr[i]] = arr[i];
>
> Although it does not matter, this matches the semantics of the Java
> version - i.e. it keeps the last object in the hash, whereas checking
> Contains() will keep the first one.
>
>
> I see TermQuery, SpanTermQuery, and PhraseQuery have addressed this
> issue already, although instead of
>
>    if (queryTerms.Contains(term) == false)    // Is this an artifact
> of a tool used in porting?
>
> I'd rather see
>
>    if (!queryTerms.Contains(term))
>
> or even better just queryTerms[term] = term with no need to check.
>
> Regards,
> tjk :)
>


Mime
View raw message