You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/07/20 17:43:46 UTC

[GitHub] [lucene-solr] msokolov opened a new pull request #800: Lucene-8920: refactor FST.Arc and utilities

msokolov opened a new pull request #800: Lucene-8920: refactor FST.Arc and utilities
URL: https://github.com/apache/lucene-solr/pull/800
 
 
   This PR contains three commits; I recommend looking at them separately since at least the first one is pretty big and mostly noise. Overall there should be no functional change, just reorg and cleanup.
   
   The first commit makes Arc (and some other FST) members private and adds accessors (setters and getters).
   
   The second commit refactors code that uses the setters, and removes the setters so that Arcs can only be modified from within the FST class. 
   
   The main change here was around the way that consumers would navigate from Arc to Arc by setting the internal state of an Arc to the desired index or position in the FST, and then call  `FST.readNextArc` to populate the remainder of the Arc members. With this change, Arc navigation is now done by calling either `FST.readArcByIndex` or `FST.readArcAtPosition`, which do the same thing that was being done before, just moving the code into `FST`.
   
   One other change needed was in the memory codec. It was modifying Arc.output in order to accumulate its result. Instead it now initially copies the Arc.output and subsequently modifies its own private copy.
   
   Finally, the third commit here refactors Arc's binarySearch implementation, which is repeated in several places into a method in `fst.Util`. I also added a few tests (in `TestUtil`) to explicitly test methods in `Util`, uncovering an off-by-one that had crept in to `Util.readCeilArc` during the refactor. That didn't seem to be caught by testing in the blocktreeords codec, its only user, but perhaps I just didn't run enough iterations.
   
   I plan to follow up with subsequent commits for functional improvements; when I do I'll open a separate PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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