Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8905

TopDocsCollector Should Have Better Error Handling For Illegal Arguments

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.0
    • None
    • None
    • New

    Description

      While writing some tests, I realised that TopDocsCollector does not behave well when illegal arguments are passed in (for eg, requesting more hits than the number of hits collected). Instead, we return a TopDocs instance with 0 hits.

       

      This can be problematic when queries are being formed by applications. This can hide bugs where malformed queries return no hits and that is surfaced upstream to client applications.

       

      I found a TODO at the relevant code space, so I believe it is time to fix the problem and throw an IllegalArgumentsException.

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              atris Atri Sharma
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 7.5h
                  7.5h