public abstract class AbstractSearchResultPage extends Object implements SearchResultPage
SearchResultPage
interface.Modifier and Type | Class and Description |
---|---|
private class |
AbstractSearchResultPage.HitIterator
This inner class is used to iterate the hits.
|
Modifier and Type | Field and Description |
---|---|
private int |
hitsPerPage |
private int |
pageCount |
private int |
pageIndex |
private String |
query |
private int |
totalHitCount |
DEFAULT_HITS_PER_PAGE
Constructor and Description |
---|
AbstractSearchResultPage(String searchQuery,
int totalHits,
int hitPerPage,
int pageNumber)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getHitEndNumber()
This method gets the absolute number of the last hit of this page.
|
int |
getHitsPerPage()
|
int |
getHitStartNumber()
This method gets the absolute number of the first hit of this page.
|
int |
getPageCount()
This method gets the number of pages used to split the
total hits. |
int |
getPageIndex()
This method gets the index of the page represented by this
search result , where
0 is the first page and is the last page. |
int |
getPagingEndIndex(int pagingRange)
This method gets the
page-index of the end page when a
number (pagingRange*2)+1 links should be rendered for paging. |
int |
getPagingStartIndex(int pagingRange)
This method gets the
page-index of the start page when a
number (pagingRange*2)+1 links should be rendered for paging. |
String |
getQuery()
This method gets the original query string that produced this result.
|
int |
getTotalHitCount()
This method gets the total number of hits for this
query . |
Iterator<SearchHit> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPageHit, getPageHitCount
forEach, spliterator
private final String query
getQuery()
private final int totalHitCount
getTotalHitCount()
private final int hitsPerPage
getHitsPerPage()
private final int pageCount
getPageCount()
private final int pageIndex
getPageIndex()
public AbstractSearchResultPage(String searchQuery, int totalHits, int hitPerPage, int pageNumber)
searchQuery
- is the query
that caused this page.totalHits
- is the total number of hits
.hitPerPage
- is the number of hits per page
.pageNumber
- is the index
of this page.public int getHitsPerPage()
getHitsPerPage
in interface SearchResultPage
SearchResultPage.DEFAULT_HITS_PER_PAGE
public int getPageCount()
total
hits. An empty
search result will have one empty page.getPageCount
in interface SearchResultPage
public int getPageIndex()
search result
, where
0
is the first page and SearchResultPage.getPageCount()
- 1
is the last page.getPageIndex
in interface SearchResultPage
public String getQuery()
getQuery
in interface SearchResultPage
public int getTotalHitCount()
query
.getTotalHitCount
in interface SearchResultPage
public int getHitStartNumber()
SearchResultPage.getPageIndex()
*SearchResultPage.getHitsPerPage()
+ 1
getHitStartNumber
in interface SearchResultPage
hit
of this page.public int getHitEndNumber()
SearchResultPage.getHitStartNumber()
+SearchResultPage.getPageHitCount()
getHitEndNumber
in interface SearchResultPage
hit
of this page.public int getPagingStartIndex(int pagingRange)
page-index
of the start page
when a
number (pagingRange*2)+1
links should be rendered for paging. The pagingRange
actually specifies the number of links forward and backwards. result-pages
is potentially NOT limited. To avoid that your GUI
layout gets broken by too many paging links, you can use this method to render a fixed number of paging
links. pagingCount
is 2 and you would have a page-count
of e.g.
10
. Then you would render links for visiting the pages from 0
to 4
if your page-index
is 0
,1
, or 2
. For a
page-index
of 3
, you would render the links from 1
to
5
and so on. getPagingStartIndex
in interface SearchResultPage
pagingRange
- the number of paging links forward and backwards.page-index
to start paging with.SearchResultPage.getPagingEndIndex(int)
public int getPagingEndIndex(int pagingRange)
page-index
of the end page
when a
number (pagingRange*2)+1
links should be rendered for paging. The pagingRange
actually specifies the number of links forward and backwards. result-pages
is potentially NOT limited. To avoid that your GUI
layout gets broken by too many paging links, you can use this method to render a fixed number of paging
links. pagingCount
is 2 and you would have a page-count
of e.g.
10
. Then you would render links for visiting the pages from 5
to 9
if your page-index
is 7
,8
, or 9
. For a
page-index
of 6
, you would render the links from 4
to
8
and so on. getPagingEndIndex
in interface SearchResultPage
pagingRange
- the number of paging links forward and backwards.page-index
to end paging with.SearchResultPage.getPagingStartIndex(int)
Copyright © 2001–2016 mmm-Team. All rights reserved.