You're creating the TopScoreDocCollector with numHits=1. This means the
collector only retains one result, but keep track of the total number of
results. Imagine a situation where there's a million hits. You want to know
the number, but you usually don't need all their doc ids.

That's why scoreDocs.length is 1.

Reply via email to