本文整理汇总了Java中com.threewks.gaetools.search.OrderComponent类的典型用法代码示例。如果您正苦于以下问题:Java OrderComponent类的具体用法?Java OrderComponent怎么用?Java OrderComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrderComponent类属于com.threewks.gaetools.search包,在下文中一共展示了OrderComponent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSortOptions
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
protected SortOptions.Builder buildSortOptions(List<OrderComponent> order) {
SortOptions.Builder sortOptions = SortOptions.newBuilder();
for (OrderComponent sort : order) {
String fieldName = getEncodedFieldName(sort.getField());
SortExpression.Builder expression = SortExpression.newBuilder().setExpression(fieldName);
expression = expression.setDirection(sort.isAscending() ? SortExpression.SortDirection.ASCENDING : SortExpression.SortDirection.DESCENDING);
IndexType indexType = metadata.getIndexType(sort.getField());
if (IndexType.SmallDecimal == indexType || IndexType.BigDecimal == indexType) {
expression = expression.setDefaultValueNumeric(sort.isDescending() ? IntLow : IntHigh);
} else if (IndexType.Date == indexType) {
expression = expression.setDefaultValueDate(sort.isDescending() ? DateLow : DateHigh);
} else {
expression = expression.setDefaultValue(sort.isDescending() ? StringLow : StringHigh);
}
sortOptions = sortOptions.addSortExpression(expression);
}
return sortOptions;
}
示例2: SearchImpl
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
protected SearchImpl(SearchExecutor<T, K, SearchImpl<T, K>> searchExecutor, List<QueryComponent> queryComponents, List<OrderComponent> sortOrder, Integer limit, Integer offset, Integer accuracy) {
super();
this.searchExecutor = searchExecutor;
this.queryComponents = queryComponents;
this.sortOrder = sortOrder;
this.limit = limit;
this.offset = offset;
this.accuracy = accuracy;
}
示例3: MockSearch
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
protected MockSearch(SearchExecutor<T, K, MockSearch<T, K>> service, List<QueryComponent> queryComponents, List<OrderComponent> sort, Integer accuracy, Integer limit, Integer offset) {
super();
this.executor = service;
this.queryComponents = queryComponents;
this.sort = sort;
this.accuracy = accuracy;
this.limit = limit;
this.offset = offset;
}
示例4: shouldApplyOrderOperation
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
@Test
public void shouldApplyOrderOperation() {
Search<LongTestEntity, Long> next = searchImpl.order("name", false);
assertThat(next, not(sameInstance(search)));
assertThat(searchImpl.order().isEmpty(), is(true));
assertThat(delegate(searchImpl).order().isEmpty(), is(true));
assertThat(next.order(), hasItems(OrderComponent.forField("name", false)));
assertThat(delegate(next).order(), hasItems(OrderComponent.forField("name", false)));
}
示例5: order
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
/**
* @return the ordered series of sort operations that were specified on this search request
*/
@Override
public List<OrderComponent> order() {
return sortOrder;
}
示例6: createNewInstance
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
protected Search<T, K> createNewInstance(List<QueryComponent> queryComponents, List<OrderComponent> sortOrder, Integer limit, Integer offset, Integer accuracy) {
return new SearchImpl<>(searchExecutor, queryComponents, sortOrder, limit, offset, accuracy);
}
示例7: order
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
@Override
public List<OrderComponent> order() {
return searchRequest.order();
}
示例8: order
import com.threewks.gaetools.search.OrderComponent; //导入依赖的package包/类
@Override
public Search<T, K> order(String field, boolean ascending) {
List<OrderComponent> sort = new ArrayList<>(this.sort);
sort.add(OrderComponent.forField(field, ascending));
return new MockSearch<>(executor, queryComponents, sort, accuracy, limit, offset);
}