Hi,

Today I have noticed that sometimes lucene sort produced strange result in plain
English names, like (String ASC)

l yy
liu yu

I traced to lucene source code, it seems to be a java English Collator problem 
(I 
set Locale.English to SortField), below I reproduced issue by a trivial code 
(pure
java):

/////
import java.util.Locale;
import java.text.Collator;

public class T1 {
  static public void main(String[] argv) {

    String s1 = "l yy";
    String s2 = "liu yu";

    //s1 = "l";
    //s2 = "liu";

    Collator col1 = Collator.getInstance(Locale.US);
    System.out.println("COLL_RES  =" + col1.compare(s1, s2));
    System.out.println("STRI_RES  =" + s1.compareTo(s2));
  }
}
/////

The result is:

COLL_RES  =1
STRI_RES  =-73

I tested different java versions and get same result, maybe I missed sth 
trivial, but
above test is really simple?

Thanks very much for helps, Lisheng


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to