コード例 #1
0
  /* (non-Javadoc)
   * @see ca.cmput301f13t03.adventure_datetime.model.IWebStorage#getComments(java.util.UUID, int from, int size)
   */
  @Override
  public List<Comment> getComments(UUID targetId, int from, int size) throws Exception {
    String sort = String.format(SORT, "timestamp", "desc");
    String query = String.format(MATCH, from, size, sort, "targetId", targetId);
    Search search = new Search.Builder(query).addIndex(_index).addType("comment").build();

    JestResult result = execute(search);
    List<Comment> comments = result.getSourceAsObjectList(Comment.class);
    mapImagesToComments(comments);

    return comments;
  }