Solr seach error - sorting by custom property

cancel
Showing results for 
Search instead for 
Did you mean: 
upforsin
Senior Member

Solr seach error - sorting by custom property

I noticed there is an error trying to execute search REST API with the sort param containing a custom property (only if at least one result does not have this custom property).

Search REST API with the sort argument 

http://localhost:8180/share/proxy/alfresco/slingshot/search/?filters=&encodedFilters=&term=pdf&sort=custom%3Atest%7Ctrue&site=&rootNode=alfresco%3A%2F%2Fcompany%2Fhome&repo=true

returns 0 results ("totalRecords": 3,"totalRecordsUpper": -1)

Without the sort param or with the OOTB sort param value, the request is correct (3 results).  If every document has the custom property there is also no error.

I'm using Alfresco Community 7.1.1.2.

 

In the logs, I can see

docker-my-test-ass-1       | 2022-02-28 13:06:34.669 ERROR (qtp21257599-22) [   x:alfresco] o.a.s.s.HttpSolrCall null:java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
docker-my-test-ass-1       | 	at org.alfresco.solr.AlfrescoCollatableTextFieldType$TextSortFieldComparator.findBestValue(AlfrescoCollatableTextFieldType.java:182)
docker-my-test-ass-1       | 	at org.alfresco.solr.AlfrescoCollatableTextFieldType$TextSortFieldComparator.copy(AlfrescoCollatableTextFieldType.java:157)
docker-my-test-ass-1       | 	at org.apache.lucene.search.TopFieldCollector$SimpleFieldCollector$1.collect(TopFieldCollector.java:141)
docker-my-test-ass-1       | 	at org.apache.lucene.search.MultiCollector$MultiLeafCollector.collect(MultiCollector.java:174)
docker-my-test-ass-1       | 	at org.apache.solr.search.DelegatingCollector.collect(DelegatingCollector.java:72)
docker-my-test-ass-1       | 	at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:246)
docker-my-test-ass-1       | 	at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:197)
docker-my-test-ass-1       | 	at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
docker-my-test-ass-1       | 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:668)
docker-my-test-ass-1       | 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:472)
docker-my-test-ass-1       | 	at org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:217)
docker-my-test-ass-1       | 	at org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1678)
docker-my-test-ass-1       | 	at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1395)
docker-my-test-ass-1       | 	at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:566)
docker-my-test-ass-1       | 	at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:545)
docker-my-test-ass-1       | 	at org.apache.solr.handler.component.AlfrescoSearchHandler.handleRequestBody(AlfrescoSearchHandler.java:376)
docker-my-test-ass-1       | 	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
docker-my-test-ass-1       | 	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
docker-my-test-ass-1       | 	at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
docker-my-test-ass-1       | 	at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
docker-my-test-ass-1       | 	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
docker-my-test-ass-1       | 	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
docker-my-test-ass-1       | 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
docker-my-test-ass-1       | 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
docker-my-test-ass-1       | 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
docker-my-test-ass-1       | 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
docker-my-test-ass-1       | 	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.Server.handle(Server.java:539)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
docker-my-test-ass-1       | 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
docker-my-test-ass-1       | 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
docker-my-test-ass-1       | 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
docker-my-test-ass-1       | 	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
docker-my-test-ass-1       | 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
docker-my-test-ass-1       | 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
docker-my-test-ass-1       | 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
docker-my-test-ass-1       | 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
docker-my-test-ass-1       | 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
docker-my-test-ass-1       | 	at java.base/java.lang.Thread.run(Thread.java:829)
docker-my-test-ass-1       |

 

My model:

                <property name="custom:test">
                    <type>d:text</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
	                  <atomic>true</atomic>
	                  <stored>false</stored> 
	                  <tokenised>false</tokenised>
	                  <facetable>true</facetable>
               		</index>
                </property>

 

2 Replies
abhinavmishra14
Advanced

Re: Solr seach error - sorting by custom property

Did you also validated the Search REST API, whether its failing for the same case:

https://docs.alfresco.com/content-services/community/develop/rest-api-guide/searching/#searching-by-...

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
upforsin
Senior Member

Re: Solr seach error - sorting by custom property

Hello @abhinavmishra14 

to be honest I do not think that URL in the docs is relevant. Wihout the sort argument it works. This URL is not created by myself, it is copied from the Browser Dev Tools while being on Alfresco Share Advanced Search after clicking "sort by" button.

It seems that in 7.x there are some serious bugs with the SOLR. Another one reported @angelborroy (MNT-22926)

And here is another one