Just started getting this error with a recent update:
Caused by: java.lang.IllegalStateException: Illegal sort type: 2
at org.apache.lucene.search.SortField.getComparator(SortField.java:492)
at
Type 2 is auto and its been deprecated in Lucene.
Not sure why you are seeing this issue though. Could be the recent
changes to Solr for LUCENE-1483 - auto now has to be resolved before
using the collector, ie using int autotype =
SortField.detectFieldType(reader, fieldname);
I remember
Digging in a little more... this is triggered by a custom search
component that takes some parameters and adds a custom filter to the
mix.
In the component prepare() function, it checks if the there is a sort
defined, if not it defaults to something:
SortSpec sortSpec =
Oh, okay. Thats a deprecated constructor that will set the type to
auto:2. Should have occurred to me that Solr doesn't use auto anyway :)
Hard to switch my mind between these two projects.
I can't remember the discussion around this and back compat :) I'll
have to dig back.
You need to
... grab the field type from Solr and set it rather than using AUTO, ...
This constructor public SortField (String field, int type, boolean
reverse)