Java Code Examples for com.google.appengine.api.search.Results#iterator()
The following examples show how to use
com.google.appengine.api.search.Results#iterator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchServiceTest.java From appengine-tck with Apache License 2.0 | 6 votes |
@Test public void testSearchServiceConfig() throws ExecutionException, InterruptedException { String indexName = "put-index"; String docId = "testPutDocs"; searchService = SearchServiceFactory.getSearchService(SearchServiceConfig.newBuilder().setDeadline(10.).build()); Index index = createIndex(indexName, docId); GetIndexesRequest request = GetIndexesRequest.newBuilder() .setIndexNamePrefix(indexName) .build(); GetResponse<Index> response = searchService.getIndexes(request); List<Index> listIndexes = response.getResults(); for (Index oneIndex : listIndexes) { Results<ScoredDocument> res = oneIndex.search(""); Iterator<ScoredDocument> it = res.iterator(); assertEquals(docId + "1", it.next().getId()); assertEquals(docId + "2", it.next().getId()); sync(); } }
Example 2
Source File: IndexTest.java From appengine-tck with Apache License 2.0 | 5 votes |
@Test public void testPutDeleteAsyncDocsByIterable() throws InterruptedException { String indexName = "put-index"; String docId = "testPutDocs"; Index index = createIndex(indexName, docId); List<String> dList = new ArrayList<>(); Results<ScoredDocument> found = searchDocs(index, "", 0); Iterator<ScoredDocument> it = found.iterator(); ScoredDocument doc = it.next(); assertEquals(docId + "1", doc.getId()); dList.add(doc.getId()); doc = it.next(); assertEquals(docId + "2", doc.getId()); dList.add(doc.getId()); GetIndexesRequest request = GetIndexesRequest.newBuilder() .setIndexNamePrefix(indexName) .build(); GetResponse<Index> response = searchService.getIndexes(request); List<Index> listIndexes = response.getResults(); for (Index oneIndex : listIndexes) { oneIndex.deleteAsync(dList); sync(); verifyDocCount(index, 0); } }