FAQ
Hi,

I have an AnalyzerDefinition:

@AnalyzerDef(name = "CustomAnalyzer",
tokenizer = @TokenizerDef(factory =
StandardTokenizerFactory.class),
filters = { @TokenFilterDef(factory =
LowerCaseFilterFactory.class) }
)

This works well, as I can do case insensitive searches, however, I sort my
results, but lowercase names remain at the end of the list of results. For
example:

Name
Mobile phone
Monitor
Searching
Testing
mobile defib

I would like to sort case insensitively, so mobile defib would appear
between Name & Mobile phone.

note, I am using wildcard queries for the search.

Is this possible?

Thanks in advance,

Kevin.


--
View this message in context: http://old.nabble.com/Sorting-case-insensitive-wildcard-queries-tp27652362p27652362.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

Search Discussions

  • Erick Erickson at Feb 19, 2010 at 1:34 pm
    You can index (but not store) the field you want to sort on
    in a separate field then sort on that field.

    How are you sorting anyway? Your message leaves open
    the possibility that you're sorting on a tokenized field, which
    is unsupported. Fields you use to sort should be
    untokenized.

    HTH
    Erick
    On Fri, Feb 19, 2010 at 6:02 AM, kevinkilroy wrote:


    Hi,

    I have an AnalyzerDefinition:

    @AnalyzerDef(name = "CustomAnalyzer",
    tokenizer = @TokenizerDef(factory =
    StandardTokenizerFactory.class),
    filters = { @TokenFilterDef(factory =
    LowerCaseFilterFactory.class) }
    )

    This works well, as I can do case insensitive searches, however, I sort my
    results, but lowercase names remain at the end of the list of results. For
    example:

    Name
    Mobile phone
    Monitor
    Searching
    Testing
    mobile defib

    I would like to sort case insensitively, so mobile defib would appear
    between Name & Mobile phone.

    note, I am using wildcard queries for the search.

    Is this possible?

    Thanks in advance,

    Kevin.


    --
    View this message in context:
    http://old.nabble.com/Sorting-case-insensitive-wildcard-queries-tp27652362p27652362.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Kevinkilroy at Feb 19, 2010 at 7:06 pm
    Hi Erick,

    Thanks for your input. I have 2 annotation fields (Sorry, I don't have
    access to the code at the moment to paste in).
    but basically, I am sorting on an un-tokenized field.

    The problem I have is that I am using wildcard queries, & from what I
    believe they don't get the filters applied from the Analyzer that I have
    defined.

    By implementing a SortComparator I was able to sort correctly, however, if
    there were some empty values, then a NullPointerException would be thrown.

    After reading through the mailing list I see other people have had this
    problem but I couldn't find a solution.

    Does anybody know of a solution to stop the NullPointerException being
    thrown when some of the fields dont have values for a custom SortComparator?

    Thanks in advance,

    Kevin.

    Erick Erickson wrote:
    You can index (but not store) the field you want to sort on
    in a separate field then sort on that field.

    How are you sorting anyway? Your message leaves open
    the possibility that you're sorting on a tokenized field, which
    is unsupported. Fields you use to sort should be
    untokenized.

    HTH
    Erick

    On Fri, Feb 19, 2010 at 6:02 AM, kevinkilroy
    wrote:
    Hi,

    I have an AnalyzerDefinition:

    @AnalyzerDef(name = "CustomAnalyzer",
    tokenizer = @TokenizerDef(factory =
    StandardTokenizerFactory.class),
    filters = { @TokenFilterDef(factory =
    LowerCaseFilterFactory.class) }
    )

    This works well, as I can do case insensitive searches, however, I sort
    my
    results, but lowercase names remain at the end of the list of results.
    For
    example:

    Name
    Mobile phone
    Monitor
    Searching
    Testing
    mobile defib

    I would like to sort case insensitively, so mobile defib would appear
    between Name & Mobile phone.

    note, I am using wildcard queries for the search.

    Is this possible?

    Thanks in advance,

    Kevin.


    --
    View this message in context:
    http://old.nabble.com/Sorting-case-insensitive-wildcard-queries-tp27652362p27652362.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    --
    View this message in context: http://old.nabble.com/Sorting-case-insensitive-wildcard-queries-tp27652362p27658845.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    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
postedFeb 19, '10 at 11:03a
activeFeb 19, '10 at 7:06p
posts3
users2
websitelucene.apache.org

2 users in discussion

Kevinkilroy: 2 posts Erick Erickson: 1 post

People

Translate

site design / logo © 2022 Grokbase