lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TJ Kolev" <>
Subject Re: Exception thrown in MultiPhraseQuery.ExtractTerms
Date Thu, 11 Sep 2008 19:05:39 GMT

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.

tjk :)

View raw message