Class ResultSetImpl
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<ResultItem>
-
- org.nuxeo.ecm.core.search.api.client.search.results.impl.ResultSetImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<ResultItem>
,Collection<ResultItem>
,List<ResultItem>
,RandomAccess
,ResultSet
public class ResultSetImpl extends ArrayList<ResultItem> implements ResultSet
Result set implementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
detachResultsFlag
protected int
offset
protected int
pageHits
protected String
query
protected int
range
0 means all resultsprotected CoreSession
session
protected SQLQuery
sqlQuery
protected int
totalHits
-
Fields inherited from class java.util.AbstractList
modCount
-
Fields inherited from interface org.nuxeo.ecm.core.search.api.client.search.results.ResultSet
ALWAYS_DETACH_SEARCH_RESULTS_KEY
-
-
Constructor Summary
Constructors Constructor Description ResultSetImpl(String query, CoreSession session, int offset, int range, List<ResultItem> resultItems, int totalHits, int pageHits)
Constructor used when a CoreSession is available.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
detachResults()
int
getOffset()
Returns the current offset for this result set.int
getPageHits()
Returns the amount of actual matching results.int
getPageNumber()
Computes the page number among the total set of results.int
getRange()
Returns the amount of results from offset requested.int
getTotalHits()
Returns the total number of hits this resultset comes from.ResultSet
goToPage(int page)
Goes to requested page.boolean
hasNextPage()
Is there another page available?boolean
isFirstPage()
Is this result set the first page of results?ResultSet
nextPage()
Computes the next page by replaying the exact same request.ResultSet
replay()
Replays the exact same query.ResultSet
replay(int offset, int range)
Replays the same query with new offset and range.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Field Detail
-
offset
protected final int offset
-
range
protected final int range
0 means all results
-
totalHits
protected final int totalHits
-
pageHits
protected final int pageHits
-
session
protected final CoreSession session
-
detachResultsFlag
protected Boolean detachResultsFlag
-
-
Constructor Detail
-
ResultSetImpl
public ResultSetImpl(String query, CoreSession session, int offset, int range, List<ResultItem> resultItems, int totalHits, int pageHits)
Constructor used when a CoreSession is available.
-
-
Method Detail
-
detachResults
public boolean detachResults()
-
getOffset
public int getOffset()
Description copied from interface:ResultSet
Returns the current offset for this result set.
-
getRange
public int getRange()
Description copied from interface:ResultSet
Returns the amount of results from offset requested.
-
nextPage
public ResultSet nextPage() throws SearchException
Description copied from interface:ResultSet
Computes the next page by replaying the exact same request.- Specified by:
nextPage
in interfaceResultSet
- Returns:
- the next computed page or null if there is none.
- Throws:
SearchException
-
goToPage
public ResultSet goToPage(int page) throws SearchException
Description copied from interface:ResultSet
Goes to requested page.- Specified by:
goToPage
in interfaceResultSet
- Parameters:
page
- the page to go to- Returns:
- the next computed page or null if there is none.
- Throws:
SearchException
-
getTotalHits
public int getTotalHits()
Description copied from interface:ResultSet
Returns the total number of hits this resultset comes from.- Specified by:
getTotalHits
in interfaceResultSet
- Returns:
- an integer value
-
getPageHits
public int getPageHits()
Description copied from interface:ResultSet
Returns the amount of actual matching results.This is in contrast to getRange() that returns the maximum number of results per page.
- Specified by:
getPageHits
in interfaceResultSet
- Returns:
- the amount of actual matching results.
-
hasNextPage
public boolean hasNextPage()
Description copied from interface:ResultSet
Is there another page available?- Specified by:
hasNextPage
in interfaceResultSet
- Returns:
- true if next page available / false if not.
-
isFirstPage
public boolean isFirstPage()
Description copied from interface:ResultSet
Is this result set the first page of results?- Specified by:
isFirstPage
in interfaceResultSet
- Returns:
- true if first page / false of not.
-
replay
public ResultSet replay() throws SearchException
Description copied from interface:ResultSet
Replays the exact same query.- Specified by:
replay
in interfaceResultSet
- Returns:
- a new, updated ResultSet
- Throws:
SearchException
-
replay
public ResultSet replay(int offset, int range) throws SearchException
Description copied from interface:ResultSet
Replays the same query with new offset and range.- Specified by:
replay
in interfaceResultSet
- Parameters:
offset
- the new offsetrange
- the new range- Returns:
- a new, updated ResultSet
- Throws:
SearchException
-
getPageNumber
public int getPageNumber()
Description copied from interface:ResultSet
Computes the page number among the total set of results.- Specified by:
getPageNumber
in interfaceResultSet
- Returns:
- the page number
-
-