Thanks.
When you are trying to determine how many items to show on a results
page
and you have:
1. number of hits you want to display (hpp)
2. total hitcount returned by Lucene from a query (hc)
3. the results page you are currently on (ipg)
there's some math involved and I was looking for that formula.
Here's one possible solution...
private static int decide_hitsper(int hpp,int hc,int ipg,String use)
{
int ri=0;
if(use.indexOf("l") !
=-1) // LOW(MIN)
{ // LOW
ri=((ipg*hpp)-(hpp-1));
} // if
else
// HIGH(MAX)
{ // MAX
if(hc>hpp)
{
if((ipg*hpp) <= hc)
ri=(ipg*hpp);
else
// few results
ri=hc;
} // inner if
else
ri=hc;
} // else
return ri;
}
Also, is there an available sample of using TopDocs .search()?
Peter W.
On Dec 27, 2006, at 10:33 PM, Erik Hatcher wrote:
On Dec 28, 2006, at 12:02 AM, Peter W. wrote:
I'm trying to iterate or page through Lucene document hits results.
Before reinventing this, is there an existing solution out there
or in Solr?
There really isn't much wheel to reinvent... you can "page" through
Hits by simply starting at any point and going forward however many
documents you want per page. You could also use TopDocs
returning .search() methods, which is what I think Solr does.
Again, not much to it - pick a starting point, and go from there.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]