当前位置: 首页>>代码示例>>Java>>正文


Java QueryComponent类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:20,代码来源:BaseGaeSearchService.java

示例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, " ");
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:9,代码来源:BaseGaeSearchService.java

示例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;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchImpl.java

示例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;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:MockSearch.java

示例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));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchImplTest.java

示例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")));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchImplTest.java

示例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;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:SearchImpl.java

示例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);
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:4,代码来源:SearchImpl.java

示例9: query

import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Override
public List<QueryComponent> query() {
    return searchRequest.query();
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:5,代码来源:SearchImpl.java

示例10: query

import com.threewks.gaetools.search.QueryComponent; //导入依赖的package包/类
@Override
public List<QueryComponent> query() {
    return queryComponents;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:5,代码来源:MockSearch.java


注:本文中的com.threewks.gaetools.search.QueryComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。