@GET
    @Path("search")
    @Timed
    @ApiOperation(value = "Get a list of all index sets")
    @ApiResponses(value = {
            @ApiResponse(code = 403, message = "Unauthorized"),
    })
    public IndexSetResponse search(@ApiParam(name = "searchTitle", value = "The number of elements to skip (offset).")
                                   @QueryParam("searchTitle") String searchTitle,
                                   @ApiParam(name = "skip", value = "The number of elements to skip (offset).", required = true)
                                   @QueryParam("skip") @DefaultValue("0") int skip,
                                   @ApiParam(name = "limit", value = "The maximum number of elements to return.", required = true)
                                   @QueryParam("limit") @DefaultValue("0") int limit,
                                   @ApiParam(name = "stats", value = "Include index set stats.")
                                   @QueryParam("stats") @DefaultValue("false") boolean computeStats) {
        final IndexSetConfig defaultIndexSet = indexSetService.getDefault();
        List<IndexSetConfig> allowedConfigurations = indexSetService.searchByTitle(searchTitle).stream()
                .filter(indexSet -> isPermitted(RestPermissions.INDEXSETS_READ, indexSet.id())).toList();

        return getPagedIndexSetResponse(skip, limit, computeStats, defaultIndexSet, allowedConfigurations);
    }
@Test
    public void testSearchIndexSets() {
        final IndexSetConfig indexSetConfig = createTestConfig("id", "title");
        String searchTitle = "Title";
        when(indexSetService.searchByTitle(searchTitle)).thenReturn(Collections.singletonList(indexSetConfig));
        final IndexSetResponse firstPage = indexSetsResource.search(searchTitle, 0, 0, false);

        verify(indexSetService, times(1)).searchByTitle(searchTitle);
        verify(indexSetService, times(1)).getDefault();
        verifyNoMoreInteractions(indexSetService);

        assertThat(firstPage.total()).isEqualTo(1);
        assertThat(firstPage.indexSets()).containsExactly(IndexSetSummary.fromIndexSetConfig(indexSetConfig, false));

        final IndexSetConfig indexSetConfig2 = createTestConfig("id2", "title2");
        when(indexSetService.searchByTitle(searchTitle)).thenReturn(List.of(indexSetConfig, indexSetConfig2));
        final IndexSetResponse secondPage = indexSetsResource.search(searchTitle, 1, 0, false);

        assertThat(secondPage.indexSets()).containsExactly(IndexSetSummary.fromIndexSetConfig(indexSetConfig2, false));
    }