You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Ryan McKinley <ry...@gmail.com> on 2009/06/18 01:19:08 UTC
aaah, using trunk is fun! -- Illegal sort type: 2
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 org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.<init>(FieldValueHitQueue.java:80)
at org.apache.lucene.search.FieldValueHitQueue.create(FieldValueHitQueue.java:190)
at org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:851)
at org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1082)
at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:880)
at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:176)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1290)
at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:139)
This only happens when I combine a custom filter with a text search
(same custom filter as the last time).
Before digging deeply into what solr/lucene rev changed the behavior,
I just want to check if this rings a bell with anyone....
thanks!
ryan
Re: aaah, using trunk is fun! -- Illegal sort type: 2
Posted by Ryan McKinley <ry...@gmail.com>.
thanks!
I replaced my code with this and it works fine now:
SortSpec sortSpec = builder.getSortSpec();
if( sortSpec.getSort() == null ) {
SchemaField sf = builder.req.getCore().getSchema()
.getField( "somefield" );
sortSpec.setSort( new Sort( new SortField[] {
sf.getSortField( true )
}));
}
thanks mark!
On Wed, Jun 17, 2009 at 8:07 PM, Mark Miller<ma...@gmail.com> wrote:
>
>> ... grab the field type from Solr and set it rather than using AUTO, ...
>
> This constructor public SortField (String field, int type, boolean reverse)
>
>
Re: aaah, using trunk is fun! -- Illegal sort type: 2
Posted by Mark Miller <ma...@gmail.com>.
> ... grab the field type from Solr and set it rather than using AUTO, ...
This constructor public SortField (String field, int type, boolean
reverse)
Re: aaah, using trunk is fun! -- Illegal sort type: 2
Posted by Mark Miller <ma...@gmail.com>.
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 resolve that Sort field since the new sort collector won't
do it for you anymore. So either grab the field type from Solr and set
it rather than using AUTO, or resolve it with:
sortField = new SortField(field, SortField.detectFieldType(reader,field));
- Mark
Ryan McKinley wrote:
> 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 = builder.getSortSpec();
> if( sortSpec.getSort() == null ) {
> sortSpec.setSort( new Sort( new SortField[] {
> new SortField( "afield", true )
> }));
> }
>
> If I comment this out, I do not get the error (not surprising)
>
> However, if I add the sort field to the original query it works without problem.
>
> Perhaps there has been some changen that now requires me to do something else?
>
> Any ideas?
>
> thanks
> ryan
>
>
>
> On Wed, Jun 17, 2009 at 7:28 PM, Mark Miller<ma...@gmail.com> wrote:
>
>> 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 this changing but not the exact details.
>>
>> Probably Solr is not doing this though.
>>
>> - Mark
>>
>> Ryan McKinley wrote:
>>
>>> 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
>>> org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.<init>(FieldValueHitQueue.java:80)
>>> at
>>> org.apache.lucene.search.FieldValueHitQueue.create(FieldValueHitQueue.java:190)
>>> at
>>> org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:851)
>>> at
>>> org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1082)
>>> at
>>> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:880)
>>> at
>>> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
>>> at
>>> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:176)
>>> at
>>> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
>>> at
>>> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
>>> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1290)
>>> at
>>> org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:139)
>>>
>>>
>>> This only happens when I combine a custom filter with a text search
>>> (same custom filter as the last time).
>>>
>>> Before digging deeply into what solr/lucene rev changed the behavior,
>>> I just want to check if this rings a bell with anyone....
>>>
>>> thanks!
>>> ryan
>>>
>>>
>> --
>> - Mark
>>
>> http://www.lucidimagination.com
>>
>>
>>
>>
>>
--
- Mark
http://www.lucidimagination.com
Re: aaah, using trunk is fun! -- Illegal sort type: 2
Posted by Ryan McKinley <ry...@gmail.com>.
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 = builder.getSortSpec();
if( sortSpec.getSort() == null ) {
sortSpec.setSort( new Sort( new SortField[] {
new SortField( "afield", true )
}));
}
If I comment this out, I do not get the error (not surprising)
However, if I add the sort field to the original query it works without problem.
Perhaps there has been some changen that now requires me to do something else?
Any ideas?
thanks
ryan
On Wed, Jun 17, 2009 at 7:28 PM, Mark Miller<ma...@gmail.com> wrote:
> 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 this changing but not the exact details.
>
> Probably Solr is not doing this though.
>
> - Mark
>
> Ryan McKinley wrote:
>>
>> 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
>> org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.<init>(FieldValueHitQueue.java:80)
>> at
>> org.apache.lucene.search.FieldValueHitQueue.create(FieldValueHitQueue.java:190)
>> at
>> org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:851)
>> at
>> org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1082)
>> at
>> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:880)
>> at
>> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
>> at
>> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:176)
>> at
>> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
>> at
>> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
>> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1290)
>> at
>> org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:139)
>>
>>
>> This only happens when I combine a custom filter with a text search
>> (same custom filter as the last time).
>>
>> Before digging deeply into what solr/lucene rev changed the behavior,
>> I just want to check if this rings a bell with anyone....
>>
>> thanks!
>> ryan
>>
>
>
> --
> - Mark
>
> http://www.lucidimagination.com
>
>
>
>
Re: aaah, using trunk is fun! -- Illegal sort type: 2
Posted by Mark Miller <ma...@gmail.com>.
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 this changing but not the exact details.
Probably Solr is not doing this though.
- Mark
Ryan McKinley wrote:
> 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 org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.<init>(FieldValueHitQueue.java:80)
> at org.apache.lucene.search.FieldValueHitQueue.create(FieldValueHitQueue.java:190)
> at org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:851)
> at org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1082)
> at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:880)
> at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
> at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:176)
> at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
> at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1290)
> at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:139)
>
>
> This only happens when I combine a custom filter with a text search
> (same custom filter as the last time).
>
> Before digging deeply into what solr/lucene rev changed the behavior,
> I just want to check if this rings a bell with anyone....
>
> thanks!
> ryan
>
--
- Mark
http://www.lucidimagination.com