[
https://issues.apache.org/jira/browse/LUCENE-5008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shai Erera resolved LUCENE-5008.
--------------------------------
Resolution: Not A Problem
Assignee: Shai Erera
This is an invalid issue. Please read the javadocs of TopDocs:
{noformat}
/** The total number of hits for the query. */
public int totalHits;
/** The top hits for the query. */
public ScoreDoc[] scoreDocs;
{noformat}
totalHits denotes the total number of documents that match the query in the
index. When you submit your query, you specify the number of "top docs" to
return (e.g. 10). scoreDocs.length <= the number you specify (e.g. if there are
less hits that match the query).
Resolving as Not A Problem. I personally usually ask a question on the user/dev
list before I open an issue, to validate the problem is indeed an issue. I
think it would be best if you follow the same practice in the future.
> The difference between totalHits and scoreDocs.length of TopDocs
> ----------------------------------------------------------------
>
> Key: LUCENE-5008
> URL: https://issues.apache.org/jira/browse/LUCENE-5008
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Affects Versions: 4.3
> Reporter: Guo Song
> Assignee: Shai Erera
> Labels: bug, lucene
>
> 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!
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]