Package org.opencastproject.search.api
Class SearchResultImpl
- java.lang.Object
-
- org.opencastproject.search.api.SearchResultImpl
-
- All Implemented Interfaces:
SearchResult
public class SearchResultImpl extends Object implements SearchResult
The search result represents a set of result items that has been compiled as a result for a search operation.
-
-
Constructor Summary
Constructors Constructor Description SearchResultImpl()
A no-arg constructor needed by JAXBSearchResultImpl(String query)
Creates a new and empty search result.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(SearchResultItemImpl item)
Adds an item to the result set.SearchResultItem[]
getItems()
The search item listlong
getLimit()
Get the limit.long
getOffset()
Get the offset.long
getPage()
Get the page of the current result.String
getQuery()
Get the user query.long
getSearchTime()
Get the search time.long
getTotalSize()
Returns the number of hits for this query, regardless of the limit that has been defined.void
setLimit(long limit)
Set the limit.void
setOffset(long offset)
Set the offset.void
setSearchTime(long searchTime)
Set the search time.void
setTotal(long total)
Sets the total hit count.long
size()
Get the total number of items found, limited by the value returned bySearchResult.getLimit()
.static SearchResultImpl
valueOf(InputStream xml)
Reads the search result from the input stream.
-
-
-
Constructor Detail
-
SearchResultImpl
public SearchResultImpl()
A no-arg constructor needed by JAXB
-
SearchResultImpl
public SearchResultImpl(String query)
Creates a new and empty search result.- Parameters:
query
- the query
-
-
Method Detail
-
valueOf
public static SearchResultImpl valueOf(InputStream xml)
Reads the search result from the input stream.- Parameters:
xml
- the input stream- Returns:
- the deserialized search result
-
getItems
public SearchResultItem[] getItems()
The search item list- Specified by:
getItems
in interfaceSearchResult
- Returns:
- Item list.
- See Also:
SearchResult.getItems()
-
addItem
public void addItem(SearchResultItemImpl item)
Adds an item to the result set.- Parameters:
item
- the item to add
-
getQuery
public String getQuery()
Get the user query.- Specified by:
getQuery
in interfaceSearchResult
- Returns:
- The user query.
- See Also:
SearchResult.getQuery()
-
size
public long size()
Get the total number of items found, limited by the value returned bySearchResult.getLimit()
.- Specified by:
size
in interfaceSearchResult
- Returns:
- The number.
- See Also:
SearchResult.size()
-
getOffset
public long getOffset()
Get the offset.- Specified by:
getOffset
in interfaceSearchResult
- Returns:
- The offset.
- See Also:
SearchResult.getOffset()
-
setOffset
public void setOffset(long offset)
Set the offset.- Parameters:
offset
- The offset.
-
getLimit
public long getLimit()
Get the limit.- Specified by:
getLimit
in interfaceSearchResult
- Returns:
- The limit.
- See Also:
SearchResult.getLimit()
-
setLimit
public void setLimit(long limit)
Set the limit.- Parameters:
limit
- The limit.
-
getSearchTime
public long getSearchTime()
Get the search time.- Specified by:
getSearchTime
in interfaceSearchResult
- Returns:
- The time in ms.
- See Also:
SearchResult.getSearchTime()
-
setSearchTime
public void setSearchTime(long searchTime)
Set the search time.- Parameters:
searchTime
- The time in ms.
-
setTotal
public void setTotal(long total)
Sets the total hit count.- Parameters:
total
- the total hit count
-
getTotalSize
public long getTotalSize()
Returns the number of hits for this query, regardless of the limit that has been defined.- Specified by:
getTotalSize
in interfaceSearchResult
- Returns:
- the total number of hits.
- See Also:
SearchResult.getTotalSize()
-
getPage
public long getPage()
Get the page of the current result.- Specified by:
getPage
in interfaceSearchResult
- Returns:
- The page.
- See Also:
SearchResult.getPage()
-
-