can not sort on a field w/o docValues unless it is indexed=true uninvertible=true and the type supports Uninversion

1.3k Views Asked by At

We are using SOLR with SI4T for TRIDION 8.5. Recently updated SOLR V5 to V8 and updated schemas as well. rest of the collections sorting works fine but for a particular collection(site) we are unable to sort the records using sort_title field. Schema remains same for all the collection.

 <fields>
    <field name="sort_title" type="alphaOnlySort" indexed="true" stored="true" multiValued="false"/>
 </fields>
    <copyField source="short_title" dest="sort_title" />

On executing a query, I see the following logs on SOLR console.

{
  "responseHeader":{
    "zkConnected":true,
    "status":400,
    "QTime":29,
    "params":{
      "q":"*:*",
      "sort":"sort_title asc",
      "_":"1584444920249"}},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"c**an not sort on a field w/o docValues unless it is indexed=true uninvertible=true and the type supports Uninversion: sort_title**",
    "code":400}}

Stack Trace on Console

org.apache.solr.common.SolrException: can not sort on a field w/o docValues unless it is indexed=true uninvertible=true and the type supports Uninversion: sort_title
    at org.apache.solr.schema.SchemaField.checkSortability(SchemaField.java:194)
    at org.apache.solr.schema.FieldType.getSortedSetSortField(FieldType.java:725)
    at org.apache.solr.schema.FieldType.getStringSort(FieldType.java:772)
    at org.apache.solr.schema.StrField.getSortField(StrField.java:87)
    at org.apache.solr.schema.SchemaField.getSortField(SchemaField.java:154)
    at org.apache.solr.search.SortSpecParsing.parseSortSpecImpl(SortSpecParsing.java:202)
    at org.apache.solr.search.SortSpecParsing.parseSortSpec(SortSpecParsing.java:60)
    at org.apache.solr.search.QParser.getSortSpec(QParser.java:281)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:187)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:302)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:211)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2596)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:799)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:578)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:419)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:351)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1711)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1347)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1678)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1249)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:505)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:781)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:917)
    at java.base/java.lang.Thread.run(Thread.java:830)

Any help apriciated!!

Issue resolved

It was really stupid ignorance. Whenever you get "can not sort on a field w/o docValues", please check the query output fields. In my case sort_title was never indexed due to some inavlid character in the schema.xml. After correcting the schema and reindexing the core it had sort_title field and sorting was working as expected.

0

There are 0 best solutions below