Package org.alfresco.service.cmr.search
Interface ResultSetSPI<ROW extends ResultSetRow,MD extends ResultSetMetaData>
-
- Type Parameters:
ROW
-MD
-
- All Superinterfaces:
Iterable<ROW>
- All Known Subinterfaces:
ResultSet
@AlfrescoPublicApi public interface ResultSetSPI<ROW extends ResultSetRow,MD extends ResultSetMetaData> extends Iterable<ROW>
This is the common interface for both row (Alfresco node) and column (CMIS style property or function) based results. The meta-data for the results sets contains the detailed info on what columns are available. For row based result sets there is no selector - all the nodes returned do not have to have a specific type or aspect. For example, an FTS search on properties of type d:content has no type constraint implied or otherwise. Searches against properties have an implied type, but as there can be more than one property -> more than one type or aspect implied (eg via OR in FTS or lucene) they are ignored An iterable result set from a searcher query. Implementations must implement the indexes for row lookup as zero-based.- Author:
- andyh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close the result set and release any resources held/ The result set is bound to the transaction and will auto close at the end of the transaction.boolean
getBulkFetch()
Do we bulk fetchint
getBulkFetchSize()
Get the bulk fetch size.ChildAssociationRef
getChildAssocRef(int n)
Get the child assoc ref for a particular row.List<ChildAssociationRef>
getChildAssocRefs()
Get a list of all the child associations in the results set.Map<String,Integer>
getFacetQueries()
Gets the facet query resultsList<Pair<String,Integer>>
getFieldFacet(String field)
Map<NodeRef,List<Pair<String,List<String>>>>
getHighlighting()
Gets the highlighting results.NodeRef
getNodeRef(int n)
Get the id of the node at the given index (if there is only one selector or no selector)List<NodeRef>
getNodeRefs()
Get a list of all the node refs in the result set (if there is only one selector or no selector)long
getNumberFound()
Attempt to get the number of rows that matched the query.MD
getResultSetMetaData()
Get the meta data for the results set.ROW
getRow(int i)
Get a row from the result set by row index, starting at 0.float
getScore(int n)
Get the score for the node at the given position (if there is only one selector or no selector)SpellCheckResult
getSpellCheckResult()
Gets the spell check resultint
getStart()
Get the start point for this results set in the overall set of rows that match the query - this will be equal to the skip count set when executing the query, and zero if this is not set.boolean
hasMore()
Was this result set curtailed - are there more pages to the result set?int
length()
Get the number of rows in this result set.boolean
setBulkFetch(boolean bulkFetch)
Bulk fetch results in the cacheint
setBulkFetchSize(int bulkFetchSize)
Set the bulk fetch size-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
length
int length()
Get the number of rows in this result set. This will be less than or equal to the maximum number of rows requested or the full length of the results set if no restriction on length are specified. If a skip count is given, the length represents the number of results after the skip count and does not include the items skipped.- Returns:
- the number of results. -1 means unknown and can be returned for lazy evaluations of permissions when the actual size is not known and evaluated upon request.
-
getNumberFound
long getNumberFound()
Attempt to get the number of rows that matched the query. This result set may only contain a section of the results. If a skip count is given the number found may or may not include the items skipped. This is best effort and only done if is cheap. For SOLR it is cheap; for the DB it may be expensive as permissions are done post query. If you want to know if there are more results to fetch use hasMore()- Returns:
- long
-
getNodeRef
NodeRef getNodeRef(int n)
Get the id of the node at the given index (if there is only one selector or no selector)- Parameters:
n
- zero-based index- Returns:
- return the the node ref for the row if there is only one selector
-
getScore
float getScore(int n)
Get the score for the node at the given position (if there is only one selector or no selector)- Parameters:
n
- zero-based index- Returns:
- return the score for the row if there is only one selector
-
close
void close()
Close the result set and release any resources held/ The result set is bound to the transaction and will auto close at the end of the transaction.
-
getRow
ROW getRow(int i)
Get a row from the result set by row index, starting at 0.- Parameters:
i
- zero-based index- Returns:
- return the row
-
getNodeRefs
List<NodeRef> getNodeRefs()
Get a list of all the node refs in the result set (if there is only one selector or no selector)- Returns:
- the node refs if there is only one selector or no selector *
-
getChildAssocRefs
List<ChildAssociationRef> getChildAssocRefs()
Get a list of all the child associations in the results set. (if there is only one selectoror no selector)- Returns:
- the child assoc refs if there is only one selector or no selector *
-
getChildAssocRef
ChildAssociationRef getChildAssocRef(int n)
Get the child assoc ref for a particular row. (if there is only one selectoror no selector)- Parameters:
n
- zero-based index- Returns:
- the child assoc ref for the row if there is only one selector or no selector
-
getResultSetMetaData
MD getResultSetMetaData()
Get the meta data for the results set.- Returns:
- the metadata
-
getStart
int getStart()
Get the start point for this results set in the overall set of rows that match the query - this will be equal to the skip count set when executing the query, and zero if this is not set.- Returns:
- the position of the first result in the overall result set
-
hasMore
boolean hasMore()
Was this result set curtailed - are there more pages to the result set?- Returns:
- true if there are more pages in the result set
-
setBulkFetch
boolean setBulkFetch(boolean bulkFetch)
Bulk fetch results in the cache- Parameters:
bulkFetch
- boolean
-
getBulkFetch
boolean getBulkFetch()
Do we bulk fetch- Returns:
- - true if we do
-
setBulkFetchSize
int setBulkFetchSize(int bulkFetchSize)
Set the bulk fetch size- Parameters:
bulkFetchSize
- int
-
getBulkFetchSize
int getBulkFetchSize()
Get the bulk fetch size.- Returns:
- the fetch size
-
getFieldFacet
List<Pair<String,Integer>> getFieldFacet(String field)
- Parameters:
field
- String- Returns:
- List
-
getFacetQueries
Map<String,Integer> getFacetQueries()
Gets the facet query results- Returns:
- Map of <requested facet query, count>
-
getHighlighting
Map<NodeRef,List<Pair<String,List<String>>>> getHighlighting()
Gets the highlighting results. Returns a Map keyed by noderef. Each value is a pair of "fieldname" and a String array of highlight snippets- Returns:
- the Map
-
getSpellCheckResult
SpellCheckResult getSpellCheckResult()
Gets the spell check result- Returns:
- SpellCheckResult
-
-