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

IllegalArgumentException when using useFilterForSortedQuery on an empty index

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 3.6, 4.0-ALPHA
    • 4.0-ALPHA
    • search
    • 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).

      Attachments

        1. SOLR-2923.patch
          0.7 kB
          Adrien Grand

        Activity

          People

            markrmiller@gmail.com Mark Miller
            jpountz Adrien Grand
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: