Skip to content
Snippets Groups Projects

feat(search): give possibility to indicates what facets should be included in response

Merged Nicolas.Rod requested to merge rodn-search-give-possibility-to-specify-facets into master
Files
3
@@ -177,6 +177,7 @@ public class SearchController extends IndexDataReadOnlyController<String, Public
@PostMapping(value = "/" + ActionName.SEARCH)
public HttpEntity<RestCollection<PublicationIndexEntry>> searchPost(@RequestBody List<AouSearchCondition> searchConditions,
@RequestParam(value = WITH_RESTRICTED_ACCESS_MASTERS_PARAM, defaultValue = "false") boolean withRestrictedAccessMaster,
@RequestParam(value = "facets", required = false) String facets,
Pageable pageable) {
// Replaces field aliases by field names, set AND operator on specific fields
@@ -190,7 +191,12 @@ public class SearchController extends IndexDataReadOnlyController<String, Public
FieldsRequest fieldsRequest = this.queryBuilderService.getDefaultFieldsRequest();
// Get facets
List<FacetRequest> facetRequests = this.queryBuilderService.getFacetsList();
List<FacetRequest> facetRequests;
if (!StringTool.isNullOrEmpty(facets)) {
facetRequests = this.queryBuilderService.getFacetsList(facets);
} else {
facetRequests = this.queryBuilderService.getFacetsList();
}
FacetPage<PublicationIndexEntry> results = this.indexResourceService.search(this.getIndex(), searchConditionList, facetRequests, pageable,
fieldsRequest);
@@ -204,7 +210,7 @@ public class SearchController extends IndexDataReadOnlyController<String, Public
List<AouSearchCondition> searchConditions = this.queryBuilderService.getStoredSearchConditions(storedSearchId);
return this.searchPost(searchConditions, withRestrictedAccessMaster, pageable);
return this.searchPost(searchConditions, withRestrictedAccessMaster, null, pageable);
}
@GetMapping(value = "/" + AouActionName.COMBINE_STORED_SEARCHES)
@@ -236,7 +242,7 @@ public class SearchController extends IndexDataReadOnlyController<String, Public
AouSearchCondition searchCondition = this.queryBuilderService.getSearchesOrPublicationsSearchCondition(searchIds, publicationIds,
combinationType, cnIndividu);
return this.searchPost(List.of(searchCondition), withRestrictedAccessMaster, pageable);
return this.searchPost(List.of(searchCondition), withRestrictedAccessMaster, null, pageable);
}
@GetMapping("/{id}/" + AouActionName.DOWNLOAD_STATUS)
@@ -336,7 +342,6 @@ public class SearchController extends IndexDataReadOnlyController<String, Public
return this.buildFileSystemResource(thumbnailFSR, contentTypeFile, 0);
}
protected ResponseEntity<FileSystemResource> buildFileSystemResource(FileSystemResource inputStream, String fileContentType,
long fileSize) {
HttpHeaders respHeaders = new HttpHeaders();
Loading