Class ResultMapper
java.lang.Object
org.alfresco.rest.api.search.impl.ResultMapper
Maps from a ResultSet to a json public api representation.
- Author:
- Gethin James
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<FacetFieldContext>
getFacetBucketsForFacetFields
(Map<String, List<Pair<String, Integer>>> facetFields, SearchQuery searchQuery) protected List<GenericFacetResponse>
getFacetBucketsForFacetFieldsAsFacets
(Map<String, List<Pair<String, Integer>>> facetFields, SearchQuery searchQuery) protected List<GenericFacetResponse>
getFacetBucketsFromFacetQueries
(Map<String, Integer> facetQueries, SearchQuery searchQuery) Builds a facet field from facet queries.protected List<GenericFacetResponse>
getFieldStats
(SearchRequestContext searchRequestContext, Map<String, Set<Metric>> stats) protected static List<GenericFacetResponse>
getGenericFacetsForIntervals
(Map<String, List<Pair<String, Integer>>> facetFields, SearchQuery searchQuery) Returns generic faceting responses for IntervalsBuilds a node representation based on a ResultSetRow;protected List<GenericFacetResponse>
getPivots
(SearchRequestContext searchRequest, List<GenericFacetResponse> pivots, List<GenericFacetResponse> stats) static boolean
hasGroup
(SearchQuery searchQuery) boolean
isNullContext
(SearchContext context) Is the context null?void
setDeletedNodes
(DeletedNodes deletedNodes) void
void
setNodeVersions
(NodeVersionsRelation nodeVersions) void
setPropertyLookup
(PropertyLookupRegistry propertyLookup) void
setServiceRegistry
(ServiceRegistry serviceRegistry) void
setStoreMapper
(StoreMapper storeMapper) Sets the total number found.toCollectionWithPagingInfo
(Params params, SearchRequestContext searchRequestContext, SearchQuery searchQuery, ResultSet results) Turns the results into a CollectionWithPagingInfotoCollectionWithPagingInfo
(org.json.JSONArray docs, SearchSQLQuery searchQuery) toSearchContext
(SearchEngineResultSet resultSet, SearchRequestContext searchRequestContext, SearchQuery searchQuery) Uses the results from Solr to set the Search Contextprotected Optional<SearchEngineResultSet>
toSearchEngineResultSet
(ResultSet results) Tries to see if the inputResultSet
or one of the wrappedResultSet
is an instance ofSearchEngineResultSet
.
-
Constructor Details
-
ResultMapper
public ResultMapper()
-
-
Method Details
-
setServiceRegistry
-
setNodeVersions
-
setDeletedNodes
-
setStoreMapper
-
setNodes
-
setPropertyLookup
-
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
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
-
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
Is the context null?- Parameters:
context
-- Returns:
- true if its null
-
toSearchEngineResultSet
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
-