文档

Timeline管理

更新时间:

Timeline管理提供了消息模糊查询、多条件组合查询以及Flush接口。

Search

Timeline管理的查询功能基于多元索引的Search接口实现,只有设置了IndexSchema的TimelineStore才支持。索引字段支持LONG、DOUBLE、BOOLEAN、KEYWORD、GEO_POINT、TEXT等数据类型,属性包含Index、Store、Array以及分词类型,其含义与多元索引相同。更多信息,请参见数据类型映射

多元索引的Search接口提供了模糊查询、多条件组合查询等功能。其中需要用于模糊查询的字段必须配置为TEXT类型并为该字段设置需要的分词类型。关于分词的更多信息,请参见分词

/**
 * Search timeline by SearchParameter.
 * */
SearchParameter searchParameter = new SearchParameter(
        field("text").equals("fieldValue")
);
timelineStore.search(searchParameter);

/**
 * Search timeline by SearchQuery.
 * */
TermQuery query = new TermQuery();
query.setFieldName("text");
query.setTerm(ColumnValue.fromString("fieldValue"));
SearchQuery searchQuery = new SearchQuery().setQuery(query).setLimit(10);
timelineStore.search(searchQuery);

Flush

批量写基于表格存储SDK中DefaultTableStoreWriter实现,可以主动调用flush接口,将Buffer中尚未发出的请求主动触发发送,同步等待至所有消息写入成功。

/**
 * Flush messages in buffer, and wait until all messages are stored.
 * */
timelineStore.flush();
  • 本页导读 (1)
文档反馈