in tablestore/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolParser.java [383:422]
public static SearchQuery toSearchQuery(byte[] bytes) throws IOException {
SearchQuery searchQuery = new SearchQuery();
Search.SearchQuery pb = Search.SearchQuery.parseFrom(bytes);
if (pb.hasOffset()) {
searchQuery.setOffset(pb.getOffset());
}
if (pb.hasLimit()) {
searchQuery.setLimit(pb.getLimit());
}
if (pb.hasQuery()) {
searchQuery.setQuery(SearchQueryParser.toQuery(pb.getQuery()));
}
if (pb.hasHighlight()) {
searchQuery.setHighlight(SearchHighlightParser.toHighlight(pb.getHighlight()));
}
if (pb.hasSort()) {
searchQuery.setSort(SearchSortParser.toSort(pb.getSort()));
}
if (pb.hasCollapse()) {
Search.Collapse collapse = pb.getCollapse();
String fieldName = collapse.getFieldName();
searchQuery.setCollapse(new Collapse(fieldName));
}
if (pb.hasTrackTotalCount()) {
searchQuery.setTrackTotalCount(pb.getTrackTotalCount());
}
if (pb.hasToken()) {
searchQuery.setToken(pb.getToken().toByteArray());
}
if (pb.hasAggs()) {
searchQuery.setAggregationList(SearchAggregationParser.toAggregations(pb.getAggs()));
}
if (pb.hasGroupBys()) {
searchQuery.setGroupByList(SearchGroupByParser.toGroupBys(pb.getGroupBys()));
}
if (pb.hasFilter()){
searchQuery.setFilter(SearchFilterParser.toSearchFilter(pb.getFilter()));
}
return searchQuery;
}