FAQ
Hi,

I'm using Lucene 2.4.1 with Hibernate Search 3.1.1. I have objects in the index, for each field I index as follows:

@Fields( value = {
@Field(index = Index.TOKENIZED, store = Store.YES),
@Field(name = "name_forSort", index = Index.UN_TOKENIZED, store = Store.NO),
})

Therefore, I can search on the 1st field, & sort on the second field. This works fine, however, the sorting results are case sensitive.

So, for example my results come back as:

A
B
C
a

But I would like

a
A
B
C

If I lowercase everything when I create the index, I do indeed get the results back as expected, however, when I search, the (highlighted) results come back in lower case.

For example: if I search for: d Or D (note I am using wildcard queries (d*)

I get:

dorcan road,

whereas, when I just list the results it comes back as Dorcan Road (which is what I want).

Can anybody provide an example of how I can sort case insensitively?

Thanks in advance,

Kevin.


_________________________________________________________________
Tell us your greatest, weirdest and funniest Hotmail stories
http://clk.atdmt.com/UKM/go/195013117/direct/01/

Search Discussions

  • Ian Lea at Mar 12, 2010 at 10:52 am
    Can you just lowercase a dedicated sort field and leave the others alone.


    --
    Ian.

    On Fri, Mar 12, 2010 at 10:47 AM, Kev Kilroy wrote:

    Hi,

    I'm using Lucene 2.4.1 with Hibernate Search 3.1.1. I have objects in the index, for each field I index as follows:

    @Fields( value = {
    @Field(index = Index.TOKENIZED, store = Store.YES),
    @Field(name = "name_forSort", index = Index.UN_TOKENIZED, store = Store.NO),
    })

    Therefore, I can search on the 1st field, & sort on the second field. This works fine, however, the sorting results are case sensitive.

    So, for example my results come back as:

    A
    B
    C
    a

    But I would like

    a
    A
    B
    C

    If I lowercase everything when I create the index, I do indeed get the results back as expected, however, when I search, the (highlighted) results come back in lower case.

    For example: if I search for: d Or D (note I am using wildcard queries (d*)

    I get:

    dorcan road,

    whereas, when I just list the results it comes back as Dorcan Road (which is what I want).

    Can anybody provide an example of how I can sort case insensitively?

    Thanks in advance,

    Kevin.


    _________________________________________________________________
    Tell us your greatest, weirdest and funniest Hotmail stories
    http://clk.atdmt.com/UKM/go/195013117/direct/01/
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 12, '10 at 10:48a
activeMar 12, '10 at 10:52a
posts2
users2
websitelucene.apache.org

2 users in discussion

Ian Lea: 1 post Kev Kilroy: 1 post

People

Translate

site design / logo © 2021 Grokbase