On Sep 13, 2013, at 03:25 , Marvin Humphrey <[email protected]> wrote:

> The root problem with TextTermStepper is that Lexicon was conceived as a
> wrapper around a mutable object -- the "term" -- whose value would be updated
> while iterating.  This is why Lexicon#Get_Term, and TermStepper#Get_Value do
> not have `incremented` return values -- they're conceived as accessors to this
> mutable term.
> 
> I think the best approach may be to change those methods to return
> `incremented` values, and that we reorient ourselves to think of them as
> factories rather than accessors.

This would mean to make MatchTermInfoStepper return incremented values, too, 
resulting in some unnecessary copying of TermInfo objects. My current approach 
is to keep a reference to the converted String in TextTermStepper:

https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=commitdiff;h=56cbd56c139cd4dfed4bb56f726626ea1092697e

> Perhaps this is an opportunity to simplify some APIs. :D
> 
> *   Change SortCache#Value to a factory which returns an `incremented` Obj and
>    eliminate the `blank` argument.
> *   Eliminate SortCache#Make_Blank.
> *   It turns out that TextType#Make_Blank and BlobType#Make_Blank are
>    unnecessary and can be removed regardless.

I already went that way in this commit:

https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=commitdiff;h=b7881f0e40bf6f5470c8314a5e6aa231817c4cde

> The other is SortFieldWriter#Refill.  SortFieldWriter is a pretty hairy
> module.  I'd think it would be best to try a minimal approach first and
> benchmark, resorting to major surgery only if absolutely necessary.


Hehe, I realized that when I found out that S_write_files in SortFieldWriter 
calls Str_Mimic via Obj_Mimic. This commit is probably wrong but I couldn't 
wrap my head around SortFieldWriter yet:

https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=commitdiff;h=ec1f886752915e4b691c4ae41dd657c47bc3a83c

Nick

Reply via email to