|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weborganic.flint.query.SearchPaging
public final class SearchPaging
This class allows for a better control of search results by specifying paging information for the index tools to use.
Pages start at 1.
Note: This has nothing to do with memory management.
Field Summary | |
---|---|
static int |
DEFAULT_HITS_PER_PAGE
The default maximum number of hits per page. |
static int |
DEFAULT_PAGE
The default maximum number of hits per page. |
Constructor Summary | |
---|---|
SearchPaging()
Creates a new paging configuration using the default values. |
|
SearchPaging(int page,
int hitsPerPage)
Creates a new paging configuration using the specified values. |
Method Summary | |
---|---|
int |
getFirstHit()
Returns the first hit based on the total number of hits. |
int |
getHitsPerPage()
Returns the number of hits per page for the searches. |
int |
getLastHit(int totalHits)
Returns the last hit for the current page in the results based on the total number hits. |
int |
getPage()
Returns the requested page number. |
int |
getPageCount(int totalHits)
Returns the number of pages in the results based on the total number hits. |
void |
setHitsPerPage(int hitsPerPage)
Sets the number of hits per page for the searches. |
void |
setPage(int page)
Sets the page number. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PAGE
public static final int DEFAULT_HITS_PER_PAGE
Constructor Detail |
---|
public SearchPaging()
public SearchPaging(int page, int hitsPerPage)
page
- The page requested.hitsPerPage
- The maximum number of results per page.Method Detail |
---|
public int getHitsPerPage()
public void setHitsPerPage(int hitsPerPage)
A negative value in indicates no limit.
hitsPerPage
- The number of hits per page for the searches.public int getPage()
public void setPage(int page)
page
- The page number.
IllegalArgumentException
- if the page is less than 1.public int getFirstHit()
If hits per page is positive, it is the result of :
HITS_PER_PAGE x (PAGE - 1) + 1
Otherwise, this method always returns 1;
public int getLastHit(int totalHits)
If hits per page is positive, it is the result of :
MIN( HITS_PER_PAGE x PAGE - 1, TOTAL_HITS)
Otherwise, this method always returns 1;
totalHits
- The total number of hits.
public int getPageCount(int totalHits)
If hits per page is positive, it is the result of :
((TOTAL_HITS - 1) / HITS_PER_PAGE) + 1
Otherwise, this method always returns 1;
totalHits
- The total number of hits.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |