本文整理匯總了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();
}
示例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));
}
示例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);
}
示例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();
示例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);