lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhavin Pandya" <bhav...@rediff.co.in>
Subject Re: NullPointerException while sorting on INT
Date Wed, 24 Oct 2007 10:04:46 GMT
Hi,

>> I am getting NullPointerException while sorting on a field using 
>> SortField.INT
>> same is working for SortField.STRING

Sorry guys... I found my mistake... I was using wrong Types.... my data has 
FLOAT data.... I used SortField.AUTO and its working fine now.

Thanks.
Bhavin pandya


----- Original Message ----- 
From: "Bhavin Pandya" <bhavinp@rediff.co.in>
To: <java-user@lucene.apache.org>
Sent: Wednesday, October 24, 2007 12:41 PM
Subject: NullPointerException while sorting on INT


Hi friends,

I am getting NullPointerException while sorting on a field using 
SortField.INT
same is working for SortField.STRING

Code Snippet:
                SortField sortfield = new 
SortField("CURRENT_BID",SortField.INT,false); // asceding sort on current 
bid value
                Sort sort = new Sort();
                sort.setSort(sortfield);
                hits = msearcher.search(bqmain,sort);  // this statement 
generates NullPointerException

Stack Trace:
java.lang.NullPointerException
        at 
org.apache.lucene.search.MultiSearcherThread.hits(ParallelMultiSearcher.java:286)
        at 
org.apache.lucene.search.ParallelMultiSearcher.search(ParallelMultiSearcher.java:141)
        at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:65)
        at org.apache.lucene.search.Hits.<init>(Hits.java:52)
        at org.apache.lucene.search.Searcher.search(Searcher.java:53)
        at _auctionSearcher__jsp._jspService(_auctionSearcher__jsp.java:359)

Same is working if i change "SoftField.INT" to "SortField.STRING"....

In index the field "CURRENT_BID" has no null value in any document....

I am using lucene 2.1.

Thanks.
Bhavin pandya




---------------------------------------------------------------------
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