lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinkilroy <kevinkil...@hotmail.com>
Subject Re: Sorting case insensitive wildcard queries
Date Fri, 19 Feb 2010 19:05:35 GMT

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
> <kevinkilroy@hotmail.com>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


Mime
View raw message