This doesn't seem pressing but irked me enough to submit a ticket. It feels that we should be able to be more correct but the current API isn't very supportive of that work flow.
I slightly prefer calling onUse() from createWeight() as it does make this edge case of the first segment go away which I feel is harder to reason about than someone creating a weight and not using it. The improved multi-threaded search code in IndexSearcher is a great example of this misbehaving where there is no guarantee that the first segment's Weight.scorer() will be called before the other segments. However I'm not familiar with use cases that use Query.createWeight() without executing some kind of search or explain to know if they are more of an issue.
Is adding bookend methods to more correctly detect the begin/end of the search phase seen as too messy and special casey?
At the end of the day I also wonder if it's worth the complexity but wanted to open this ticket to bootstrap the discussion as this could be a hard problem to diagnose in the future (someone wants to know why their query isn't getting cached and it's due to some obscure detail like this).