You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Antony Bowesman <ad...@thorntothehorn.org> on 2011/04/14 13:36:17 UTC

NullPointerException in FieldSortedHitQueue

Upgrading from 2.3.2 to 2.9.4 I get NPE as below

Caused by: java.lang.NullPointerException
	at 
org.apache.lucene.search.FieldSortedHitQueue$1.createValue(FieldSortedHitQueue.java:224)
	at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:224)
	at 
org.apache.lucene.search.FieldSortedHitQueue.getCachedComparator(FieldSortedHitQueue.java:176)
	at org.apache.lucene.search.FieldSortedHitQueue.<init>(FieldSortedHitQueue.java:56)

I have a SortField that is created something like

new SortField(fieldName, comparator)

which generates a custom SortField, but in the call to Comparators.get() fails 
because createValue in FieldSortedHitQueue calls

         case SortField.CUSTOM:
           comparator = factory.newComparator (reader, fieldname);

and factory is null.

Is this a bug?  I know FSHQ is deprecated, but presumably it should still work 
with a SortField containing a comparator?

Thanks
Antony

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