コード例 #1
0
  /* (non-Javadoc)
   * @see ca.cmput301f13t03.adventure_datetime.model.IWebStorage#queryStories(Java.lang.String, int, int)
   */
  public List<Story> queryStories(String filter, int from, int size) throws Exception {
    String sort = String.format(SORT, "timestamp", "desc");
    String query = String.format(MULTI_MATCH, from, size, sort, filter);
    Search search = new Search.Builder(query).addIndex(_index).addType("story").build();

    JestResult result = execute(search);
    List<Story> stories = result.getSourceAsObjectList(Story.class);
    mapImagesToStories(stories);

    return stories;
  }