lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-5628) SpecialOperations.getFiniteStrings should not recurse
Date Thu, 24 Apr 2014 09:45:16 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-5628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979519#comment-13979519
] 

Michael McCandless commented on LUCENE-5628:
--------------------------------------------

Good feedback, thanks!

bq. can we put the exit condition into the while block instead of at the end with a break
I think it can just be while(string.length > 0)

Fixed.

bq. looking at the impl of State I think we can just use an identity hashset or maybe even
an array since the Ids are within known bounds to check the pathStates? You could even just
us a bitset and mark the state ID as visited? Hmm now that I wrote it I see your comment 
I will leave it here for dicsussion.

I switched to IdentityHashSet.

Yeah I struggled w/ this, but the original method didn't set the state
numbers so I didn't want to change that.  Setting the numbers does a
DFS on the automaton...

bq. Somewhat unrelated but I think the State implementation has a problem since it doen't
override equlas but it should since it has an hashcode impl. I wonder if we either should
remove the hashCode or add equals just for consistency?

I removed State.hashCode.

bq. should we rather throw IllegalState than IllegalArgument 

Hmm, IAE felt right since you passed it an invalid (cyclic) argument?

bq. just for readability it might be good to s/strings/finiteStrings/ I had a hard time to
see when you do things on the string vs. strings

I changed to results.

bq. is this a leftover ==> // a.getNumberedStates();

Removed.


> SpecialOperations.getFiniteStrings should not recurse
> -----------------------------------------------------
>
>                 Key: LUCENE-5628
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5628
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 4.9, 5.0
>
>         Attachments: LUCENE-5628.patch, LUCENE-5628.patch
>
>
> Today it consumes one Java stack frame per transition, which when used by AnalyzingSuggester
is per character in each token.  This can lead to stack overflows if you have a long suggestion.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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


Mime
View raw message