: In order to paint "Next" links app would have to know total number of
: records that user is eligible for read. getNumFound() will tell me that
: there are total 4K records that Solr returned. If there wasn't any
: entitlement rules then it could have been easier to determine how many
: "Next" links to paint and when user clicks on "Next" pass in "start"
: position appropriately in solr query. Since I have to apply post filter as
: and when results are fetched from Solr is there a better way to achieve

In an ideal world, you would do this using a custom plugin -- either a 
SearchComponent or a QParser used i na filter query.

if you really have to do this client side, then a few basic rules come to 
mind...

1) allways over request.  if you estimate that your user can only fiew 1/X 
docs in your total collection, and you want ot show Y results per page, 
then your rows param should be at least 2*X*Y (i picked 2 just for good 
measure, just because you know the average doesn't mean you know the real 
distrobution)

2) however many rows you get back, you need to keep track of the "real" 
start param you used, and at what in the current page you had enough docs 
to show the user -- that will determine your next "start" param.

3) wether you have a "next" link or not depends on:
3a) wether you had any left over the first time you over requested (see 
#2 above)
3b) wether numFound was greater then the index of the last item you got.
...if 3a and 3b are both false, you definitley don't need a "next" link. 
 if either of them is true then you probably *should* give them a next 
link, but you still need to be prepared for the possibility that you won't 
have any more docs (they might only be half way through the result set, 
but every remaining doc might be something they arne't allowed to see)

there's really no clean way to avoid the possibility completley, unless 
you really crank up how agressively you over request -- ultimatley if you 
over request *all* matches, then you can know definitively wether to give 
them a next link at any point.

-Hoss

Reply via email to