开发者

Sorting in Lucene treats word differently between upper and lower case?

开发者 https://www.devze.com 2023-03-11 05:56 出处:网络
I have the following code on sorting[1], but I ended up with a result开发者_运维百科 set in which words begin with numeric placed first and then words in uppercase sorted ascendingly with words in low

I have the following code on sorting[1], but I ended up with a result开发者_运维百科 set in which words begin with numeric placed first and then words in uppercase sorted ascendingly with words in lowercase sorted ascendingly at the bottom, like below [2].

Is this by design? If so how can I sort them without the case being taken into consideration?

[1] Searcher.Search(Query, null, 30, new Sort(new SortField("title", SortField.STRING)));

[2] [42bskfdj3434] [Fast Five] [Green Lantern] [Kung Fu Panda] [bob] [laptop] [xoom] [yearn]


Index the field "title" as ANALYZED and use an analyzer that lowercases the input text (eg, StandardAnalyzer)

0

精彩评论

暂无评论...
验证码 换一张
取 消