On Mon, Feb 18, 2008 at 4:29 PM, Ryan Gravener <[EMAIL PROTECTED]> wrote:
> You could keep an instance of the search results in the dataprovider.
>  Then on size() and iterator() check to see if results is null.  If it
>  is perform the query and store the results

Yes, I tried this before and I won't work because of querying size()
before iterator() - to get results I need to know what is first result
and how many of them to fetch, I don't know this in DataProvider
because some other class (DataView?) manage the values provided to
iterator (first and count). As I said size() is used BEFORE iterator()
so size has to ask for results first, as I don't know where I am in
result set (eg. I don't know getCurrentPage() for DataView), I cannot
in size() ask for eg. SearchDAO.SearchResults searchedAdverts =
searchDAO.getSearchedAdverts(this.query, 40, 20);

As I would know or can pass getCurrentPage() to the DataProvider
constructor I could fetch the result set in size() method and put them
into field of SearchDataProvider.

Maybe I should explain how Hibernate Search works here - when asking
DAO for results first search is asked and it returns all the docsId
which next are sliced based on first, count parameters - next same
engine ask database for objects eg "form Advertisement a where a.id in
(1,23,45,67,77)" - in one pass I can get 20 objects from whole results
set and the exact number of documents which are proper for search
criteria.

Is it more clear now I'm not English specialist :) ?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to