Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9094

ReRanker should gracefully handle sorts without score

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.10.4
    • None
    • search
    • Solr 4.10.4
      CentOS 6.5 64 bit
      Java 1.8.0_51

    Description

      I have a Solr 4.10.4 instance with a RequestHandler that has a re-ranking query configured like this:

      solrconfig.xml
      <lst name="defaults">
                  <str name="defType">dismax</str>
                  ...
                  <str name="rqq">{!boost b=someFunction() v=$q}</str>
                  <str name="rq">{!rerank reRankQuery=$rqq reRankDocs=60 reRankWeight=1.2}</str>
                  <str name="sort">score desc</str>
      </lst>
      

      Everything is working until the client sends a sort params that doesn't include the score field. So if for example the request contains "sort=price asc" then a NullPointerException is thrown:

      09:46:08,548 ERROR [org.apache.solr.core.SolrCore] java.lang.NullPointerException
      [INFO] [talledLocalContainer]     at org.apache.lucene.search.TopFieldCollector$OneComparatorScoringMaxScoreCollector.collect(TopFieldCollector.java:291)
      [INFO] [talledLocalContainer]     at org.apache.solr.search.ReRankQParserPlugin$ReRankCollector.collect(ReRankQParserPlugin.java:263)
      [INFO] [talledLocalContainer]     at org.apache.solr.search.SolrIndexSearcher.sortDocSet(SolrIndexSearcher.java:1999)
      [INFO] [talledLocalContainer]     at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1423)
      [INFO] [talledLocalContainer]     at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:514)
      [INFO] [talledLocalContainer]     at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:484)
      [INFO] [talledLocalContainer]     at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:218)
      [INFO] [talledLocalContainer]     at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
      

      The only way to avoid this exception is to explicitly add the "score desc" value to the incoming field; that is

      ?q=...&sort=price asc, score desc 
      

      In this way I get no exception. I said "explicitly" because adding an "appends" section in my handler

      <lst name="appends">
          <str name="sort">score desc</str>
      </lst>
      

      Even I don't know if that could solve my problem, in practice it is completely ignoring (i.e. I'm still getting the NPE above).

      However, when I explicitly add "sort=price asc, score desc", as consequence of the re-ranking, the top 60 results, although I said to Solr "order by price", are still shuffled and that's not what I want.

      So, at the end, the issue is about the following two points:

      1. the NullPointerException above
      2. a way to disable the re-ranking (automatically or not)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              a.gazzarini Andrea Gazzarini
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: