本文整理汇总了Java中com.threewks.gaetools.search.QueryComponent类的典型用法代码示例。如果您正苦于以下问题:Java QueryComponent类的具体用法?Java QueryComponent怎么用?Java QueryComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QueryComponent类属于com.threewks.gaetools.search包,在下文中一共展示了QueryComponent类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertQueryComponentToQueryFragment
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
protected String convertQueryComponentToQueryFragment(QueryComponent queryComponent) {
if (!queryComponent.isFieldedQuery()) {
return queryComponent.getQuery();
}
String field = this.getEncodedFieldName(queryComponent.getField());
if (field == null) {
throw new SearchException("Unable to build query string - there is no field named '%s' on %s", queryComponent.getField(), type.getSimpleName());
}
String operation = IsSymbols.get(queryComponent.getIs());
if (queryComponent.isCollectionQuery()) {
List<String> values = convertValuesToString(field, queryComponent.getCollectionValue());
String stringValue = StringUtils.join(values, " OR ");
return String.format("%s:(%s)", field, stringValue);
} else {
String value = convertValueToString(field, queryComponent.getValue());
return String.format("%s%s%s", field, operation, value);
}
}
示例2: buildQueryString
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
protected String buildQueryString(List<QueryComponent> queryComponents) {
List<String> stringQueryComponents = new ArrayList<>();
for (QueryComponent queryComponent : queryComponents) {
String fragmentString = convertQueryComponentToQueryFragment(queryComponent);
stringQueryComponents.add(fragmentString);
}
return StringUtils.join(stringQueryComponents, " ");
}
示例3: SearchImpl
import com.threewks.gaetools.search.QueryComponent; //导入依赖的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;
}
示例4: MockSearch
import com.threewks.gaetools.search.QueryComponent; //导入依赖的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;
}
示例5: shouldApplyAndRetainQuery
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Test
public void shouldApplyAndRetainQuery() {
Search<LongTestEntity, Long> next = searchImpl.query("Text");
assertThat(next, not(sameInstance(search)));
assertThat(next.query(), hasItems(QueryComponent.forRawQuery("Text")));
assertThat(delegate(next).query(), hasItems(QueryComponent.forRawQuery(("Text"))));
assertThat(searchImpl.query().isEmpty(), is(true));
assertThat(delegate(searchImpl).query().isEmpty(), is(true));
}
示例6: shouldApplyFieldOperation
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Test
public void shouldApplyFieldOperation() {
Search<LongTestEntity, Long> next = searchImpl.field("name", Is.EqualTo, "value");
assertThat(next, not(sameInstance(search)));
assertThat(next.query(), hasItem(QueryComponent.forFieldQuery("name", Is.EqualTo, "value")));
assertThat(searchImpl.query().isEmpty(), is(true));
assertThat(delegate(searchImpl).query().isEmpty(), is(true));
assertThat(delegate(next).query(), hasItem(QueryComponent.forFieldQuery("name", Is.EqualTo, "value")));
}
示例7: query
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
/**
* @return the ordered series of query fragments that were specified on this search request
*/
@Override
public List<QueryComponent> query() {
return queryComponents;
}
示例8: createNewInstance
import com.threewks.gaetools.search.QueryComponent; //导入依赖的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);
}
示例9: query
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Override
public List<QueryComponent> query() {
return searchRequest.query();
}
示例10: query
import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Override
public List<QueryComponent> query() {
return queryComponents;
}