lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (Updated) (JIRA)" <>
Subject [jira] [Updated] (LUCENE-3695) FST Builder methods need fixing,documentation,or improved type safety
Date Sun, 15 Jan 2012 23:39:39 GMT


Michael McCandless updated LUCENE-3695:

    Fix Version/s: 4.0
> FST Builder methods need fixing,documentation,or improved type safety
> ---------------------------------------------------------------------
>                 Key: LUCENE-3695
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3695.patch, LUCENE-3695.patch
> Its confusing the way an FST Builder has 4 add() methods, and you get assertion errors
(what happens if assertions are disabled?) if you use the wrong one:
> For reference we have 3 FST input types:
> * BYTE1 (byte)
> * BYTE2 (char)
> * BYTE4 (int)
> For the builder add() method signatures we have:
> * add(BytesRef)
> * add(char[], int offset, int len)
> * add(CharSequence)
> * add(IntsRef)
> But certain methods only work with certain FST input types, and these mappings are not
the ones you think. 
> For example, you would think that if you have a char-based FST you should use add(char[])
or add(CharSequence), but this is not the case: those add methods actually only work with
int-based FST (they use codePointAt() to extract codepoints). Instead, you have to use add(IntsRef)
for the char-based one.
> The worst is if you use the wrong one, you get an assertion error, but i'm not sure what
happens if assertions are disabled.
> Maybe the ultimate solution is to parameterize FST's generics on input too (FST<input,output>)
and just require BytesRef/CharsRef/IntsRef as the parameter? Then you could just have add(),
and this might clean up FSTEnum too (it would no longer need that InputOutput class but maybe
could use Map.Entry<input,output> or something?
> I think the documentation is improving but i still notice add(BytesRef) has no javadoc
at all, and it only works with BYTE1, so I think we still have some work to do even if we
want to just pursue a documentation fix.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message