當前位置: 首頁>>代碼示例>>Java>>正文


Java Cursor類代碼示例

本文整理匯總了Java中org.springframework.data.solr.core.query.result.Cursor的典型用法代碼示例。如果您正苦於以下問題:Java Cursor類的具體用法?Java Cursor怎麽用?Java Cursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Cursor類屬於org.springframework.data.solr.core.query.result包,在下文中一共展示了Cursor類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: queryForCursor

import org.springframework.data.solr.core.query.result.Cursor; //導入依賴的package包/類
public <T> Cursor<T> queryForCursor(Query query, final Class<T> clazz) {

		return new DelegatingCursor<T>(queryParsers.getForClass(query.getClass()).constructSolrQuery(query)) {

			@Override
			protected org.springframework.data.solr.core.query.result.DelegatingCursor.PartialResult<T> doLoad(
					SolrQuery nativeQuery) {

				QueryResponse response = executeSolrQuery(nativeQuery);
				if (response == null) {
					return new PartialResult<T>("", Collections.<T> emptyList());
				}

				return new PartialResult<T>(response.getNextCursorMark(), convertQueryResponseToBeans(response, clazz));
			}

		}.open();
	}
 
開發者ID:ramaava,項目名稱:spring-data-solr,代碼行數:19,代碼來源:SolrTemplate.java

示例2: testDelegatingCursorLoadsAllElements

import org.springframework.data.solr.core.query.result.Cursor; //導入依賴的package包/類
/**
 * @see DATASOLR-162
 */
@Test
public void testDelegatingCursorLoadsAllElements() throws IOException {

	solrTemplate.saveBeans(createBeansWithId(100));
	solrTemplate.commit();

	Cursor<ExampleSolrBean> cursor = solrTemplate.queryForCursor(
			new SimpleQuery("*:*").addSort(new Sort(Direction.DESC, "id")), ExampleSolrBean.class);

	int i = 0;
	while (cursor.hasNext()) {
		cursor.next();
		i++;
	}
	cursor.close();

	Assert.assertThat(i, Is.is(100));
}
 
開發者ID:ramaava,項目名稱:spring-data-solr,代碼行數:22,代碼來源:ITestSolrTemplate.java

示例3: findAllUsingCursor

import org.springframework.data.solr.core.query.result.Cursor; //導入依賴的package包/類
@Override
public Cursor<Product> findAllUsingCursor() {

	// NOTE: Using Cursor requires to sort by an unique field
	return solrTemplate.queryForCursor(new SimpleQuery("*:*").addSort(new Sort("id")), Product.class);
}
 
開發者ID:Just-Fun,項目名稱:spring-data-examples,代碼行數:7,代碼來源:ProductRepositoryImpl.java

示例4: findAllUsingCursor

import org.springframework.data.solr.core.query.result.Cursor; //導入依賴的package包/類
/**
 * Use a {@link Cursor} to scroll through documents in index. <br />
 * <strong>NOTE:</strong> Requires at least Solr 4.7.
 * 
 * @return
 */
Cursor<Product> findAllUsingCursor();
 
開發者ID:Just-Fun,項目名稱:spring-data-examples,代碼行數:8,代碼來源:ProductRepositoryCustom.java

示例5: queryForCursor

import org.springframework.data.solr.core.query.result.Cursor; //導入依賴的package包/類
/**
 * Executes the given {@link Query} and returns an open {@link Cursor} allowing to iterate of results, dynamically
 * fetching additional ones if required.
 * 
 * @param query
 * @param clazz
 * @return
 * @since 1.3
 */
<T> Cursor<T> queryForCursor(Query query, Class<T> clazz);
 
開發者ID:ramaava,項目名稱:spring-data-solr,代碼行數:11,代碼來源:SolrOperations.java


注:本文中的org.springframework.data.solr.core.query.result.Cursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。