com.algolia.search.saas.Query.setPage()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中com.algolia.search.saas.Query.setPage方法的一些代码示例,展示了Query.setPage的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setPage方法的具体详情如下:
包路径:com.algolia.search.saas.Query
类名称:Query
方法名:setPage

Query.setPage介绍

[英]Set the page to retrieve (zero base). Defaults to 0.
[中]设置要检索的页面(零基数)。默认值为0。

代码示例

代码示例来源:origin: algolia/instantsearch-android

/**
 * Takes the given query's parameters for following search queries.
 * <p>
 * <b>This method resets the current page to 0.</b>
 *
 * @param query a {@link Query} object with some parameters set.
 * @return this {@link Searcher} for chaining.
 */
@NonNull
public Searcher setQuery(@NonNull Query query) {
  this.query = query;
  this.query.setPage(0);
  return this;
}

代码示例来源:origin: algolia/instantsearch-android

private void rebuildQueryNumericFilters() {
  JSONArray numericFilters = new JSONArray();
  for (SparseArray<NumericRefinement> refinements : numericRefinements.values()) {
    for (int i = 0; i < refinements.size(); i++) {
      numericFilters.put(refinements.valueAt(i).toString());
    }
  }
  //noinspection deprecation (deprecated for end-users of API Client)
  query.setNumericFilters(numericFilters);
  query.setPage(0);
}

代码示例来源:origin: algolia/instantsearch-android

private Searcher rebuildQueryFacetFilters() {
  JSONArray facetFilters = new JSONArray();
  for (Map.Entry<String, List<String>> entry : refinementMap.entrySet()) {
    final List<String> values = entry.getValue();
    final String attribute = entry.getKey();
    for (String value : values) {
      facetFilters.put(attribute + ":" + value);
    }
  }
  for (Map.Entry<String, Boolean> entry : booleanFilterMap.entrySet()) {
    facetFilters.put(entry.getKey() + ":" + entry.getValue());
  }
  //noinspection deprecation Deprecated for app developers
  query.setFacetFilters(facetFilters);
  query.setPage(0);
  return this;
}

代码示例来源:origin: algolia/instantsearch-android

/**
 * Changes the targeted index for future queries.
 * <p>
 * <b>Be aware that as index ordering may differ, this method will reset the current page to 0.</b>
 * You may want to use {@link Searcher#reset} to reinitialize the helper to an empty state.
 *
 * @param indexName name of the new index.
 * @return this {@link Searcher} for chaining.
 */
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
@NonNull
public Searcher setIndex(@NonNull String indexName) {
  if (client == null) {
    throw new IllegalStateException("This method requires an Algolia Index and not a custom Searchable");
  }
  searchable = client.getIndex(indexName);
  query.setPage(0);
  return this;
}

代码示例来源:origin: algolia/instantsearch-android

return this;
query.setPage(++lastRequestPage);
final int currentRequestId = ++lastRequestId;
EventBus.getDefault().post(new SearchEvent(this, query, currentRequestId));

代码示例来源:origin: algolia/algoliasearch-client-android

@Test
public void page() {
  Query query = new Query();
  assertNull(query.getPage());
  query.setPage(0);
  assertEquals(Integer.valueOf(0), query.getPage());
  assertEquals("0", query.get("page"));
  assertEquals(query.getPage(), Query.parse(query.build()).getPage());
}

相关文章