Ignore Case in Sorting

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ignore Case in Sorting

wawa-2
Hello,

I wonder that there is anyway to ignore case(up & lower) in sorting.
I just used Sort() method and Lucene sorted result Uppercase first and then lowercase.

ex)
Apple
Banana
apple

Is there a way to sort like below?:

Apple
apple
Banana
Reply | Threaded
Open this post in threaded view
|

Re: Ingnore Case in Sorting

Erick Erickson
You could always implement your own sorter, but I really have to ask why you
are storing things in your index case-sensitive in the first place. In the
above example, if you're searching on "banana", you'll get no hits. That may
be your desired behavior....

You could also store a sort field in your index that's lower-cased and sort
on that (as well as the case-sensitive field)

On 1/10/07, wawa <[hidden email]> wrote:

>
>
> Hello,
>
> I wonder that there is anyway to ignore case(up & lower) in sorting.
> I just used Sort() method and Lucene sorted result Uppercase first and
> then
> lowercase.
>
> ex)
> Apple
> Banana
> apple
>
> Is there a way to sort like below?:
>
> Apple
> apple
> Banana
> --
> View this message in context:
> http://www.nabble.com/Ingnore-Case-in-Sorting-tf2953305.html#a8260262
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>