lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nadav Har'El" <>
Subject Re: Controlling Hits
Date Sun, 26 Nov 2006 08:07:26 GMT
On Fri, Nov 24, 2006, Otis Gospodnetic wrote about "Controlling Hits":
> Hi,
> Could we make Hits non-final, or at least expose something in Hits to control the number
of Documents it reads from disk?
> Or maybe the answer is: Use the search method that returns TopDocs if you want more control...?

In an application I was writing, I was facing similar issues: "Hits" was fine
for a short Demo in Lucene, but when it came to a real application, it didn't
give me enough control: it reran the search too many times when you wanted
to see, e.g, the 20th result page, and wouldn't allow me adding a HitCollector
which I needed. I started by modifying Hits (which wasn't just final - much
of its functionality was private), but then realized: there's simply no
reason to use Hits! which returns TopDocs already
gives you full control, and frankly isn't that much harder to use.

In fact, I fail to see a situation where "Hits"'s concept of "random access"
to the results (you can ask for result #30 and then #70) even makes sense.
In all search applications I'm familar with, at the time you call search(),
you already know how many results you want to display - and you don't need
someone to guess for you that you need 50 results, and if that's not enough
then you need 100 results, and then 200, and so on.
And since this concept of "random access" is what differenciates Hits from
TopDocs, perhaps we don't need Hits at all?

So, how about deprecating Hits altogether, and recommending the TopDocs
alternatives instead?

Nadav Har'El                        |       Sunday, Nov 26 2006, 5 Kislev 5767
IBM Haifa Research Lab              |-----------------------------------------
                                    |God created the world out of nothing, but           |the nothingness still shows through.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message