lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Smiley (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SOLR-2762) FSTLookup returns one less suggestion than it should when onlyMorePopular=true
Date Fri, 16 Sep 2011 05:41:08 GMT

     [ https://issues.apache.org/jira/browse/SOLR-2762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

David Smiley updated SOLR-2762:
-------------------------------

    Attachment: SOLR-2762_FSTLookup_off_by_one.patch

The bug is that the "if (exactMatchFirst) {" condition fails to consider the fact that an
exact match is already in the results. As I was fooling around with my data, it was usually
already there.

I added code to check to see if the key is already present and if so to shift it to the top.
I also made a trivial change to the existing code you wrote that was in this condition that
changed the order of shrinking the result array before inserting a new LookupResult into the
first position. This will avoid ArrayList needlessly growing its array.  As an aside, it's
not clear to me why you did a min(10,num) when initializing the ArrayList capacity.

I have to admit that this code seems overall tricky to test due to all the branch conditions.
 And this method probably has a high cyclomatic complexity. It would be nice to move the "if
(exactMatchFirst) {" branch outside the loops. At a glance it seems doable but then I noticed
getExactMatchStartingFromRootArc(i,key) took the loop index 'i' and I'm not sure what the
implications are there.

> FSTLookup returns one less suggestion than it should when onlyMorePopular=true
> ------------------------------------------------------------------------------
>
>                 Key: SOLR-2762
>                 URL: https://issues.apache.org/jira/browse/SOLR-2762
>             Project: Solr
>          Issue Type: Bug
>          Components: spellchecker
>    Affects Versions: 3.3
>            Reporter: David Smiley
>            Assignee: Dawid Weiss
>            Priority: Minor
>         Attachments: SOLR-2762_FSTLookup_off_by_one.patch
>
>
> I'm using the Suggester.  When I switched from TSTLookup to FSTLookup, I noticed that
it returned one fewer suggestion than what I asked for. I have spellcheck.onlyMorePopular=true;
when I set it to false, I see the correct count. Another aspect of the bug is that this off-by-one
bug only seems to occur when my suggestion has an exact match.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message