public SearchIdResult<String> search(ProjectMeasuresQuery query, SearchOptions searchOptions) {
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
      .fetchSource(false)
      .trackTotalHits(true)
      .from(searchOptions.getOffset())
      .size(searchOptions.getLimit());

    AllFilters allFilters = createFilters(query);
    RequestFiltersComputer filtersComputer = createFiltersComputer(searchOptions, allFilters);
    addFacets(searchSourceBuilder, searchOptions, filtersComputer, query);
    addSort(query, searchSourceBuilder);

    filtersComputer.getQueryFilters().ifPresent(searchSourceBuilder::query);
    filtersComputer.getPostFilters().ifPresent(searchSourceBuilder::postFilter);
    SearchResponse response = client.search(EsClient.prepareSearch(TYPE_PROJECT_MEASURES.getMainType())
      .source(searchSourceBuilder));
    return new SearchIdResult<>(response, id -> id, system2.getDefaultTimeZone().toZoneId());
  }
@Test
  public void does_not_return_facet_when_no_facets_in_options() {
    index(
      newDoc(PROJECT1, NCLOC, 10d, COVERAGE_KEY, 30d, MAINTAINABILITY_RATING, 3d)
        .setQualityGateStatus(OK.name()));

    Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions()).getFacets();

    assertThat(facets.getAll()).isEmpty();
  }