You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "gitesh (Jira)" <ji...@apache.org> on 2019/11/19 01:47:00 UTC

[jira] [Updated] (LUCENE-9053) java.lang.AssertionError: inputs are added out of order lastInput=[f0 9d 9c 8b] vs input=[ef ac 81 67 75 72 65]

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

gitesh updated LUCENE-9053:
---------------------------
    Description: 
Even if the inputs are sorted in unicode order, I get following exception while creating FST:

 
{code:java}
// Input values (keys). These must be provided to Builder in Unicode sorted order!
String inputValues[] = {"𝐴", "figure", "flagship"};
long outputValues[] = {5, 7, 12};
PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
BytesRefBuilder scratchBytes = new BytesRefBuilder();
IntsRefBuilder scratchInts = new IntsRefBuilder();
for (int i = 0; i < inputValues.length; i++) {
 scratchBytes.copyChars(inputValues[i]);
 builder.add(Util.toIntsRef(scratchBytes.get(), scratchInts), outputValues[i]);
}
FST<Long> fst = builder.finish();
Long value = Util.get(fst, new BytesRef("figure"));
System.out.println(value);
{code}
 Please note that figure {color:#172b4d}and{color} flagship {color:#172b4d}are using the ligature character{color} fl {color:#172b4d}above. {color}

  was:
Even if the inputs are sorted in unicode order, I get following exception while creating FST:

 
{code:java}
// Input values (keys). These must be provided to Builder in Unicode sorted order!
String inputValues[] = {"𝐴", "figure", "flagship"};
long outputValues[] = {5, 7, 12};
PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
BytesRefBuilder scratchBytes = new BytesRefBuilder();
IntsRefBuilder scratchInts = new IntsRefBuilder();
for (int i = 0; i < inputValues.length; i++) {
 scratchBytes.copyChars(inputValues[i]);
 builder.add(Util.toIntsRef(scratchBytes.get(), scratchInts), outputValues[i]);
}
FST<Long> fst = builder.finish();
Long value = Util.get(fst, new BytesRef("figure"));
System.out.println(value);
{code}
 


> java.lang.AssertionError: inputs are added out of order lastInput=[f0 9d 9c 8b] vs input=[ef ac 81 67 75 72 65]
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-9053
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9053
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: gitesh
>            Priority: Minor
>
> Even if the inputs are sorted in unicode order, I get following exception while creating FST:
>  
> {code:java}
> // Input values (keys). These must be provided to Builder in Unicode sorted order!
> String inputValues[] = {"𝐴", "figure", "flagship"};
> long outputValues[] = {5, 7, 12};
> PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
> Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
> BytesRefBuilder scratchBytes = new BytesRefBuilder();
> IntsRefBuilder scratchInts = new IntsRefBuilder();
> for (int i = 0; i < inputValues.length; i++) {
>  scratchBytes.copyChars(inputValues[i]);
>  builder.add(Util.toIntsRef(scratchBytes.get(), scratchInts), outputValues[i]);
> }
> FST<Long> fst = builder.finish();
> Long value = Util.get(fst, new BytesRef("figure"));
> System.out.println(value);
> {code}
>  Please note that figure {color:#172b4d}and{color} flagship {color:#172b4d}are using the ligature character{color} fl {color:#172b4d}above. {color}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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