public static Result search() {
    DynamicForm form = Form.form().bindFromRequest(request());
    JsonObject parent = new JsonObject();

    int offset = SEARCH_DEFAULT_PAGE_OFFSET;
    int limit = SEARCH_DEFAULT_PAGE_LIMIT;
    int end = 0;
    int total = 0;

    if (form.get("offset") != null && form.get("offset") != "") {
      offset = Integer.parseInt(form.get("offset"));
    }

    if (form.get("limit") != null && form.get("limit") != "") {
      limit = Integer.parseInt(form.get("limit"));
    }

    if (offset < 0) {
      offset = 0;
    }

    if (limit > SEARCH_APPLICATION_MAX_OFFSET) {
      limit = SEARCH_APPLICATION_MAX_OFFSET;
    } else if (limit <= 0) {
      return ok(new Gson().toJson(parent));
    }

    Query<AppResult> query =
        Application.generateSearchQuery(AppResult.getSearchFields(), Application.getSearchParams());

    total = query.findRowCount();

    if (offset > total) {
      offset = total;
    }

    List<AppResult> results = query.setFirstRow(offset).setMaxRows(limit)
        .fetch(AppResult.TABLE.APP_HEURISTIC_RESULTS, AppHeuristicResult.getSearchFields()).findList();

    end = offset + results.size();

    JsonArray applicationSummaryArray = new JsonArray();

    for (AppResult application : results) {
      JsonObject applicationObject = new JsonObject();
      JsonArray heuristicsArray = new JsonArray();
      List<AppHeuristicResult> appHeuristicResult = application.yarnAppHeuristicResults;

      for (AppHeuristicResult heuristic : appHeuristicResult) {
        JsonObject heuristicObject = new JsonObject();
        heuristicObject.addProperty(JsonKeys.NAME, heuristic.heuristicName);
        heuristicObject.addProperty(JsonKeys.SEVERITY, heuristic.severity.getText());
        heuristicsArray.add(heuristicObject);
      }

      applicationObject.addProperty(JsonKeys.ID, application.id);
      applicationObject.addProperty(JsonKeys.USERNAME, application.username);
      applicationObject.addProperty(JsonKeys.START_TIME, application.startTime);
      applicationObject.addProperty(JsonKeys.FINISH_TIME, application.finishTime);
      applicationObject.addProperty(JsonKeys.RUNTIME, application.finishTime - application.startTime);
      applicationObject.addProperty(JsonKeys.WAITTIME, application.totalDelay);
      applicationObject.addProperty(JsonKeys.RESOURCE_USED, application.resourceUsed);
      applicationObject.addProperty(JsonKeys.RESOURCE_WASTED, application.resourceWasted);
      applicationObject.addProperty(JsonKeys.SEVERITY, application.severity.getText());
      applicationObject.addProperty(JsonKeys.QUEUE, application.queueName);

      applicationObject.add(JsonKeys.HEURISTICS_SUMMARY, heuristicsArray);
      applicationSummaryArray.add(applicationObject);
    }

    JsonObject searchResults = new JsonObject();
    searchResults.addProperty(JsonKeys.ID, query.toString());
    searchResults.addProperty(JsonKeys.START, offset);
    searchResults.addProperty(JsonKeys.END, end);
    searchResults.addProperty(JsonKeys.TOTAL, total);
    searchResults.add(JsonKeys.SUMMARIES, applicationSummaryArray);
    parent.add(JsonKeys.SEARCH_RESULTS, searchResults);
    return ok(new Gson().toJson(parent));
  }
Returns the search results for the given query
@return
JsonObject:

<pre>
  {
        search-results: {
        id: "id"
        start: 0,
        end: 20,
        total: 0,
        summaries: [
                 {
                   application_summary_object
                 }
               ]
         }
 }
</pre>
app/controllers/api/v1/Web.java