Class ResultMapper
- java.lang.Object
-
- org.alfresco.rest.api.search.impl.ResultMapper
-
public class ResultMapper extends Object
Maps from a ResultSet to a json public api representation.- Author:
- Gethin James
-
-
Constructor Summary
Constructors Constructor Description ResultMapper()
-
Method Summary
-
-
-
Method Detail
-
setServiceRegistry
public void setServiceRegistry(ServiceRegistry serviceRegistry)
-
setNodeVersions
public void setNodeVersions(NodeVersionsRelation nodeVersions)
-
setDeletedNodes
public void setDeletedNodes(DeletedNodes deletedNodes)
-
setStoreMapper
public void setStoreMapper(StoreMapper storeMapper)
-
setNodes
public void setNodes(Nodes nodes)
-
setPropertyLookup
public void setPropertyLookup(PropertyLookupRegistry propertyLookup)
-
toCollectionWithPagingInfo
public CollectionWithPagingInfo<Node> toCollectionWithPagingInfo(Params params, SearchRequestContext searchRequestContext, SearchQuery searchQuery, ResultSet results)
Turns the results into a CollectionWithPagingInfo- Parameters:
params
-searchQuery
-results
-- Returns:
- CollectionWithPagingInfo
-
getNode
public Node getNode(ResultSetRow aRow, Params params, Map<String,UserInfo> mapUserInfo, boolean isHistory)
Builds a node representation based on a ResultSetRow;- Parameters:
aRow
-params
-mapUserInfo
-isHistory
-- Returns:
- Node
-
setTotal
public Integer setTotal(ResultSet results)
Sets the total number found.- Parameters:
results
-- Returns:
- An integer total
-
toSearchContext
public SearchContext toSearchContext(SearchEngineResultSet resultSet, SearchRequestContext searchRequestContext, SearchQuery searchQuery)
Uses the results from Solr to set the Search Context- Parameters:
searchQuery
-- Returns:
- SearchContext
-
hasGroup
public static boolean hasGroup(SearchQuery searchQuery)
-
getFacetBucketsFromFacetQueries
protected List<GenericFacetResponse> getFacetBucketsFromFacetQueries(Map<String,Integer> facetQueries, SearchQuery searchQuery)
Builds a facet field from facet queries.- Parameters:
facetQueries
-- Returns:
-
getFieldStats
protected List<GenericFacetResponse> getFieldStats(SearchRequestContext searchRequestContext, Map<String,Set<Metric>> stats)
-
getPivots
protected List<GenericFacetResponse> getPivots(SearchRequestContext searchRequest, List<GenericFacetResponse> pivots, List<GenericFacetResponse> stats)
-
getFacetBucketsForFacetFieldsAsFacets
protected List<GenericFacetResponse> getFacetBucketsForFacetFieldsAsFacets(Map<String,List<Pair<String,Integer>>> facetFields, SearchQuery searchQuery)
-
getFacetBucketsForFacetFields
protected List<FacetFieldContext> getFacetBucketsForFacetFields(Map<String,List<Pair<String,Integer>>> facetFields, SearchQuery searchQuery)
-
getGenericFacetsForIntervals
protected static List<GenericFacetResponse> getGenericFacetsForIntervals(Map<String,List<Pair<String,Integer>>> facetFields, SearchQuery searchQuery)
Returns generic faceting responses for Intervals- Parameters:
facetFields
-searchQuery
-- Returns:
- GenericFacetResponse
-
isNullContext
public boolean isNullContext(SearchContext context)
Is the context null?- Parameters:
context
-- Returns:
- true if its null
-
toSearchEngineResultSet
protected Optional<SearchEngineResultSet> toSearchEngineResultSet(ResultSet results)
Tries to see if the inputResultSet
or one of the wrappedResultSet
is an instance ofSearchEngineResultSet
. Since some concrete ResultSet implements the decorator patterns, the code assumes (in those cases) a nested structure with a maximum of 3 levels. Probably the code could be generalised better in order to scan a decorator chain with an unlimited depth, but that would require a change in the ResultSet interface.
-
toCollectionWithPagingInfo
public CollectionWithPagingInfo<TupleList> toCollectionWithPagingInfo(org.json.JSONArray docs, SearchSQLQuery searchQuery) throws org.json.JSONException
- Throws:
org.json.JSONException
-
-