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

The difference between totalHits and scoreDocs.length of TopDocs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 4.3
    • Fix Version/s: None
    • Component/s: core/search
    • Labels:
    • Lucene Fields:
      New

      Description

      TopDocs hits = searcher.search(query, N);
      hits.totalHits is not equal to hits.scoreDocs.length in lucene whose version is 4.3.0
      when I write the fllowing codes:
      for (int i = 0; i < hits.totalHits; i++)

      { int id = hits.scoreDocs[i].doc; //... }

      It may throw ArrayIndexOutOfBoundsException, but in version 4.0.0, the value of hits.totalHits and the value of hits.scoreDocs.length are qual!
      And I think they should be qual!
      Thank you!

        Attachments

          Activity

            People

            • Assignee:
              shaie Shai Erera
              Reporter:
              songguo Guo Song
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: