public abstract class AbstractSearchResult extends Object implements SearchResult
SearchResult
interface.Constructor and Description |
---|
AbstractSearchResult(String searchQuery)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
SearchResultPage |
getPage(int pageIndex)
This method gets the
page of this search-result at the
given pageIndex using the default number of
hits per page. |
SearchResultPage |
getPage(int pageIndex,
int hitsPerPage)
|
int |
getPageCount()
|
int |
getPageCount(int hitsPerPage)
|
String |
getQuery()
This method gets the original query string that produced this result.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHit, getHitCount
private final String query
getQuery()
public String getQuery()
getQuery
in interface SearchResult
public int getPageCount()
pages
used to split the total
hits
using the default
number of
hits per page. An empty search result will have one empty page.getPageCount
in interface SearchResult
SearchResult.getPageCount(int)
public int getPageCount(int hitsPerPage)
pages
used to split the total
hits using the given hitsPerPage
. An empty search result will have one empty page.getPageCount
in interface SearchResult
hitsPerPage
- is the desired number of hits per page
. This
should be a value like 5, 10, 20, 30, ..., 100.pages
required to split the total
hits
.public SearchResultPage getPage(int pageIndex)
page
of this search-result
at the
given pageIndex
using the default
number of
hits per page.getPage
in interface SearchResult
pageIndex
- is the page index
of the requested
search result
. This should be in the range from 0
to
SearchResult.getPageCount()
- 1
. pageIndex
is always valid in the sense as described
above (the search index may have been modified in the meantime). An implementation has to be able
to handle calls with a pageIndex
greater or equal to
SearchResultPage.getPageCount()
. The recommended strategy is to return the
last page in this case.SearchEngine.search(SearchQuery, int)
public SearchResultPage getPage(int pageIndex, int hitsPerPage)
page
of this search-result
at the
given pageIndex
using the given hitsPerPage
.
This method is a simple implementation of this method. Please override if there is a more efficient way
to do this.getPage
in interface SearchResult
pageIndex
- is the page index
of the requested
search result
. This should be in the range from 0
to
getPageCount(hitsPerPage)
- 1
. pageIndex
is always valid in the sense as described
above (the search index may have been modified in the meantime). An implementation has to be able
to handle calls with a pageIndex
greater or equal to
SearchResultPage.getPageCount()
. The recommended strategy is to return the
last page in this case.hitsPerPage
- is the number of hits
contained in a SearchResultPage
.SearchEngine.search(SearchQuery, int)
Copyright © 2001–2016 mmm-Team. All rights reserved.