Andrea Gazzarini created SOLR-9095:
--------------------------------------

             Summary: ReRanker should gracefully handle sorts without score
                 Key: SOLR-9095
                 URL: https://issues.apache.org/jira/browse/SOLR-9095
             Project: Solr
          Issue Type: Bug
          Components: search
    Affects Versions: 4.10.4
         Environment: Solr 4.10.4 
CentOS 6.5 64 bit
Java 1.8.0_51 
            Reporter: Andrea Gazzarini
            Priority: Minor


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

{code:title=solrconfig.xml|borderStyle=solid}
<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>
{code}

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:

{code}
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)
{code}

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

{code}
?q=...&sort=price asc, score desc 
{code}

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

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

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)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to