@Test public void testGetItems() { assertEquals(limit, result.getItems().length); double relevance = Double.MAX_VALUE; for (SearchResultItem item : result.getItems()) { if (item.getRelevance() > relevance) fail("Result items are not ordered"); relevance = item.getRelevance(); } }
public SearchResultItem[] getItems() { if (result == null) return new SearchResultItem[] {}; if (!sorted) { Collections.sort(result); sorted = true; } return result.toArray(new SearchResultItem[result.size()]); }
SearchResultImpl implements SearchResult { public SearchResultItem[] getItems() { if (result == null) return new SearchResultItem[] {}; if (!sorted) { Collections.sort(result); sorted = true; } return result.toArray(new SearchResultItem[result.size()]); } }
SearchResultImpl implements SearchResult { public SearchResultItem[] getItems() { if (result == null) return new SearchResultItem[] {}; if (!sorted) { Collections.sort(result); sorted = true; } return result.toArray(new SearchResultItem[result.size()]); } SearchResultImpl(SearchQuery query, long hitCount, long documentCount); }
SearchResultImpl implements SearchResult { public SearchResultItem[] getItems() { if (result == null) return new SearchResultItem[] {}; if (!sorted) { Collections.sort(result); sorted = true; } return result.toArray(new SearchResultItem[result.size()]); } SearchResultImpl(SearchQuery query, long hitCount, long documentCount); void addResultItem(SearchResultItem item); SearchResultItem[] getItems(); long getLimit(); long getOffset(); long getPage(); long getPageSize(); SearchQuery getQuery(); void setSearchTime(long time); long getSearchTime(); long getHitCount(); long getDocumentCount(); void setDocumentCount(long count); String toXml(); }
SearchResultImpl implements SearchResult { public SearchResultItem[] getItems() { if (result == null) return new SearchResultItem[] {}; if (!sorted) { Collections.sort(result); sorted = true; } return result.toArray(new SearchResultItem[result.size()]); } SearchResultImpl(SearchQuery query, long hitCount, long documentCount); void addResultItem(SearchResultItem item); SearchResultItem[] getItems(); long getLimit(); long getOffset(); long getPage(); long getPageSize(); SearchQuery getQuery(); void setSearchTime(long time); long getSearchTime(); long getHitCount(); long getDocumentCount(); void setDocumentCount(long count); String toXml();  }