On Sep 6, 2006, at 12:56 AM, jacky wrote:
hi,
The following words are quoted from "lucene in action":
"There are a couple of implementation approaches:
1. Keep the original Hits and IndexSearcher instances available
while the
user is navigating the search results.
2. Requery each time the user navigates to a new page.
It turns out that requerying is most often the best solution.
Requerying eliminates
the need to store per-user state. In a web application, staying
stateless (no
HTTP session) is often desirable. Requerying at first glance seems
a waste, but
Lucene’s blazing speed more than compensates. "
I am confused about this paragraph. Since Hits is just a simple
container of pointers
to ranked search results, it doesn't load from the index all
documents that match a query,
but only a small portion of them at a time. If we requery, we will
get a new hits, why not
just keeping the orginal Hits which will not waste much memory.
Requerying helps avoid server-side sessions in a web application.
Hits requires the same IndexSearcher, but in cases where the index is
changing and a new IndexSearcher is being swapped in, it requires
more management to keep old IndexSearcher's around until they are no
longer needed. I prefer the simplicity of requerying until there is
actually a performance issue to address. There is nothing wrong with
the alternative of keeping Hits around, its just not as simple.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]