lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Tschumy <b...@otherwise.com>
Subject Re: Strange sort error
Date Tue, 12 Apr 2005 13:19:17 GMT
This problem is seeming more and more strange.  It now looks like if  
the fieldName I'm sorting on starts is ASCII "j" or above, the  
RuntimeException is thrown.  Any fieldName that starts with "i" or  
below (including capitals) works.  Can anyone think of what could  
possibly be going on here?


On Apr 11, 2005, at 2:27 PM, Bill Tschumy wrote:

> In my application, by default I display all documents that are in the  
> index.  I sort them either using a "time modified" or "time created".   
> If I have a newly created empty index, I find I get an error if I sort  
> by "time modified" but not "time created".  In either case there are  
> actually no documents that match my query so in reality there is  
> nothing to sort.
>
> Here is my query:
>
> query = new TermQuery(new Term(MyIndexer.CREATOR_KEY,  
> MyIndexer.PARSNIPS_VAL));
> String fieldName = sortType == Parsnips.SORT_BY_MODIFIED ?  
> MyIndexer.MODIFIED_KEY : MyIndexer.CREATED_KEY;
> Sort sorter = new Sort(new SortField(fieldName, SortField.STRING,  
> true));
> hits = searcher.search(query, sorter);
>
> The error I'm getting when using MyIndexer.MODIFIED_KEY (which is  
> "modified") as the sort field is:
>
> java.lang.RuntimeException: no terms in field modified
>         at  
> org.apache.lucene.search.FieldCacheImpl.getStringIndex(FieldCacheImpl.j 
> ava:256)
>         at  
> org.apache.lucene.search.FieldSortedHitQueue.comparatorString(FieldSort 
> edHitQueue.java:265)
>         at  
> org.apache.lucene.search.FieldSortedHitQueue.getCachedComparator(FieldS 
> ortedHitQueue.java:180)
>         at  
> org.apache.lucene.search.FieldSortedHitQueue.<init>(FieldSortedHitQueue 
> .java:58)
>         at  
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:122)
>         at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64)
>         at org.apache.lucene.search.Hits.<init>(Hits.java:51)
>         at org.apache.lucene.search.Searcher.search(Searcher.java:41)
>         at  
> com.otherwise.parsnips.MySearcher.search(MySearcher.java:170)
>         at  
> com.otherwise.parsnips.MySearcher.search(MySearcher.java:149)
>         at com.otherwise.parsnips.Parsnips.<init>(Parsnips.java:163)
>         at com.otherwise.parsnips.Parsnips.main(Parsnips.java:1205)
>
> I can't understand why I would be getting this for one sort field but  
> not the other given there are 0 hits anyway in a newly created index.   
> Anyone have any thoughts?  I am using Lucene 1.4.2.
>
> -- 
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
-- 
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.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