Package org.sonar.server.search

Examples of org.sonar.server.search.QueryContext.addFacets()


    RuleQuery query = createRuleQuery(ruleService.newRuleQuery(), request);
    SearchOptions searchOptions = SearchOptions.create(request);
    QueryContext queryContext = mapping.newQueryOptions(searchOptions);
    Boolean facets = request.paramAsBoolean(PARAM_FACETS);
    if (facets != null && facets) {
      queryContext.addFacets(Arrays.asList("languages", "repositories", "tags"));
    }

    Result<Rule> results = ruleService.search(query, queryContext);

    JsonWriter json = response.newJsonWriter().beginObject();
View Full Code Here


  private QueryContext getQueryContext(Request request) {
    int pageSize = request.mandatoryParamAsInt(PARAM_PAGE_SIZE);
    QueryContext queryContext = new QueryContext().addFieldsToReturn(request.paramAsStrings(PARAM_FIELDS));
    List<String> facets = request.paramAsStrings(PARAM_FACETS);
    if(facets != null) {
      queryContext.addFacets(facets);
    }
    if (pageSize < 1) {
      queryContext.setPage(request.mandatoryParamAsInt(PARAM_PAGE), 0).setMaxLimit();
    } else {
      queryContext.setPage(request.mandatoryParamAsInt(PARAM_PAGE), pageSize);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.