Tobias Kässmann created SOLR-15437:
--------------------------------------

             Summary: ReRanking does work in combination with custom sort and 
SolrCloud
                 Key: SOLR-15437
                 URL: https://issues.apache.org/jira/browse/SOLR-15437
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: contrib - LTR, query parsers, SolrCloud
    Affects Versions: 8.8.2
            Reporter: Tobias Kässmann


[~TomGilke], [~tboeghk] and I are currently working a lot on the Solr LTR 
feature. In our setup we're using a custom sort function for a solid base 
scoring of the documents.

We found out that a plain SolrCloud will return random sorted docs if you 
define a custom sort field or function. This problem is also mentioned 
[here|https://lucene.472066.n3.nabble.com/Ranking-issue-when-combining-sorting-and-re-ranking-on-SolrCloud-multiple-shards-td4457723.html]
 and is not really fixed.

You can do the following steps to reproduce this issue: 
<link_will_follow_in_a_minute>

In the meantime we're also investing on this issue and try to debug the 
QueryComponent. But if there is any hint or thought available, we're very happy 
to hear from you. Maybe [~cpoerschke] can help here a little bit?

What we've found out so far:
 * It only happens in SolrCloud mode (shards > 1)
 * Maybe is has something to do the with 
[MergeStrategy|https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L188]
 in the QueryComponent.

The following test will help to reproduce this issue:
{code:java}
  @Test
  public void testSimpleQueryCustomSort() throws Exception {
    SolrQuery query = new SolrQuery("*:*");
    query.setRequestHandler("/query");
    query.setFields("*,score,[shard]");
    query.setParam("rows", "8");
    query.setParam("sort", "id asc");
    query.add("rq", "{!ltr model=powpularityS-model reRankDocs=8}");

    QueryResponse queryResponse =
            solrCluster.getSolrClient().query(COLLECTION, query);
    assertEquals(8, queryResponse.getResults().getNumFound());
    assertEquals("8", queryResponse.getResults().get(0).get("id").toString());
    assertEquals("7", queryResponse.getResults().get(1).get("id").toString());
    assertEquals("6", queryResponse.getResults().get(2).get("id").toString());
    assertEquals("5", queryResponse.getResults().get(3).get("id").toString());
    assertEquals("4", queryResponse.getResults().get(4).get("id").toString());
    assertEquals("3", queryResponse.getResults().get(5).get("id").toString());
    assertEquals("2", queryResponse.getResults().get(6).get("id").toString());
    assertEquals("1", queryResponse.getResults().get(7).get("id").toString());
  }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to