lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Jones <TJo...@hoovers.com>
Subject Re: RuntimeException on sorted search over an empty index
Date Wed, 24 Mar 2004 19:24:56 GMT
thanks - I've checked in a fix for this.

it will still throw an exception if the type of sort field is not explicitly
given.


> -----Original Message-----
> From: Jon Pipitone [mailto:jpipitone@mshri.on.ca]
> Sent: Wednesday, March 24, 2004 12:39 PM
> To: lucene-dev@jakarta.apache.org
> Subject: RuntimeException on sorted search over an empty index
> 
> 
> Hi folks,
> 
> This might be more apt for the User list, but here goes.
> 
> I've been trying out the new sorting capabilities from the latest CVS 
> build.  I'm really impressed with the performance (over a 
> single index 
> and multiple indices) and how easy it is to use.
> 
> But, I find when I do a sorted search over an emtpy index I get the 
> following sort of RuntimeException:
> 
> java.lang.RuntimeException: no terms in field id
> 	at 
> org.apache.lucene.search.IntegerSortedHitQueue$1.generateSortI
> ndex(IntegerSortedHitQueue.java:91)
> 	at 
> org.apache.lucene.search.IntegerSortedHitQueue$1.<init>(Intege
rSortedHitQueue.java:80)
> 	at 
> org.apache.lucene.search.IntegerSortedHitQueue.comparator(Inte
gerSortedHitQueue.java:77)
> 	at 
> org.apache.lucene.search.FieldSortedHitQueue.getCachedComparat
> or(FieldSortedHitQueue.java:127)
> 	at 
> org.apache.lucene.search.MultiFieldSortedHitQueue.<init>(Multi
FieldSortedHitQueue.java:54)
> 	at 
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:171)
> 	at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:102)
> 	at org.apache.lucene.search.Hits.<init>(Hits.java:89)
> 	at org.apache.lucene.search.Searcher.search(Searcher.java:79)
> 
> 
> I get this when I use an integer sort field like so:
> 
> 	Sort sort = new Sort(new SortField("id", SortField.INT));
> 	Directory dir = new RAMDirectory();
> 	(new IndexWriter(dir, new StandardAnalyzer(), true)).close();
> 	IndexSearcher searcher = new IndexSearcher(dir);
> 	Hits hits = searcher.search(query, sort);
> 
> I can't see why an exception should be being thrown here, since there 
> are no records to return, and the type of sort field is explicitly 
> integer (so there's no need to discover the type by inspecting an 
> existing term).  I would expect to get back an empty Hits, as 
> I would if 
> I hadn't provided the sort.
> 
> Thanks,
> jp

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


Mime
View raw message