Solr
  1. Solr
  2. SOLR-2923

IllegalArgumentException when using useFilterForSortedQuery on an empty index

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.6, 4.0-ALPHA
    • Fix Version/s: 4.0-ALPHA
    • Component/s: search
    • Labels:
      None

      Description

      An IllegalArgumentException can occur under the following circumstances:

      • the index is empty,
      • useFilterForSortedQuery is enabled,
      • queryResultsCache is disabled.

      Here are what the exception and its stack trace look like (Solr trunk):

      numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count

      java.lang.IllegalArgumentException: numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count
      at org.apache.lucene.search.TopFieldCollector.create(TopFieldCollector.java:917)
      at org.apache.solr.search.SolrIndexSearcher.sortDocSet(SolrIndexSearcher.java:1741)
      at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1211)
      at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:353)
      ...

      To reproduce this error from a fresh copy of Solr trunk, edit example/solr/conf/solrconfig.xml to disable queryResultCache and enable useFilterForSortedQuery. Then run ant run-example and issue a query which sorts against any field (http://localhost:8983/solr/select?q=*:*&sort=manu+desc for example).

      1. SOLR-2923.patch
        0.7 kB
        Adrien Grand

        Activity

        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Adrien Grand added a comment -

        Hi Mark, thanks for the review!

        Show
        Adrien Grand added a comment - Hi Mark, thanks for the review!
        Mark Miller made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 4.0 [ 12314992 ]
        Resolution Fixed [ 1 ]
        Hide
        Mark Miller added a comment -

        Thanks Adrien!

        Show
        Mark Miller added a comment - Thanks Adrien!
        Hide
        Mark Miller added a comment -

        patch looks good to me

        Show
        Mark Miller added a comment - patch looks good to me
        Mark Miller made changes -
        Assignee Mark Miller [ markrmiller@gmail.com ]
        Hide
        Adrien Grand added a comment -

        Could someone review this patch?

        Show
        Adrien Grand added a comment - Could someone review this patch?
        Adrien Grand made changes -
        Field Original Value New Value
        Attachment SOLR-2923.patch [ 12524460 ]
        Hide
        Adrien Grand added a comment -

        This patch fixes the issue.

        Show
        Adrien Grand added a comment - This patch fixes the issue.
        Hide
        Stefan Will added a comment -

        This also affects 3.5

        Show
        Stefan Will added a comment - This also affects 3.5
        Adrien Grand created issue -

          People

          • Assignee:
            Mark Miller
            Reporter:
            Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development