use of org.hibernate.search.query.engine.spi.QueryDescriptor in project nikita-noark5-core by HiOA-ABI.
the class FondsHateoasController method findAllFonds.
// Find all fonds using elasticsearch ... This is experimental and not part of the standard
// No swagger documentation on this. If we decide to drop db for es, then all re
// GET [contextPath][api]/arkivstruktur/arkiv/all/
@RequestMapping(method = RequestMethod.GET, value = FONDS + SLASH + "all" + SLASH)
public ResponseEntity<FondsHateoas> findAllFonds(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "filter", required = false) String filter) {
Session session = entityManager.unwrap(Session.class);
FullTextSession fullTextSession = Search.getFullTextSession(session);
QueryDescriptor query = ElasticsearchQueries.fromQueryString("title:test fonds");
List<Fonds> result = fullTextSession.createFullTextQuery(query, Fonds.class).list();
FondsHateoas fondsHateoas = new FondsHateoas((ArrayList<INikitaEntity>) (ArrayList) result);
fondsHateoasHandler.addLinks(fondsHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(fondsHateoas);
}
Aggregations