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


Java Search类代码示例

本文整理汇总了Java中com.threewks.gaetools.search.Search的典型用法代码示例。如果您正苦于以下问题:Java Search类的具体用法?Java Search怎么用?Java Search使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Search类属于com.threewks.gaetools.search包,在下文中一共展示了Search类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Test
public void shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided() {
    StringTestEntity testEntity = new StringTestEntity("1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("2", "name");
    StringTestEntity testEntity3 = new StringTestEntity("3", "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    Search<StringTestEntity, String> search = repository.search();
    assertThat(search.run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<String> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (StringTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:23,代码来源:StringRepositoryTest.java

示例2: shouldReindexEntitiesBasedOnSearch

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Test
public void shouldReindexEntitiesBasedOnSearch() {
    LongTestEntity testEntity = new LongTestEntity(1, "original");
    LongTestEntity testEntity2 = new LongTestEntity(2, "original");
    LongTestEntity testEntity3 = new LongTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    Search<LongTestEntity, Long> search = repository.search().field("name", Is.Is, "original");
    assertThat(search.run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<LongTestEntity> all = ObjectifyService.ofy().load().type(LongTestEntity.class).list();
    for (LongTestEntity e : all) {
        e.setName("other name");
    }
    ObjectifyService.ofy().save().entities(all).now();

    List<Long> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(search.run().getResults().isEmpty(), is(true));
    assertThat(repository.search().field("name", Is.Is, "other name").run().getResultIds().size(), is(3));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:24,代码来源:LongRepositoryTest.java

示例3: search

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Override
public Search<E, K> search() {
    if (!isSearchable) {
        throw new BaseException("Unable to search on type %s - there is no search service available to this repository", entityType.getSimpleName());
    }
    return new SearchImpl<>(this, searchService.search());
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:AbstractRepository.java

示例4: createSearchResult

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Override
public com.threewks.gaetools.search.Result<E, K> createSearchResult(SearchImpl<E, K> searchRequest) {
    Search<E, Key<E>> delegate = searchRequest.getSearchRequest();
    final com.threewks.gaetools.search.Result<E, Key<E>> delegateResults = delegate.run();
    return new com.threewks.gaetools.search.Result<E, K>() {
        @Override
        public List<E> getResults() throws SearchException {
            return loadInternal(delegateResults.getResultIds());
        }

        @Override
        public List<K> getResultIds() throws SearchException {
            return fromKeys.from(delegateResults.getResultIds());
        }

        @Override
        public long getMatchingRecordCount() {
            return delegateResults.getMatchingRecordCount();
        }

        @Override
        public long getReturnedRecordCount() {
            return delegateResults.getReturnedRecordCount();
        }

        @Override
        public String cursor() {
            return delegateResults.cursor();
        }

    };
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:33,代码来源:AbstractRepository.java

示例5: shouldApplyAndRetainLimit

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Test
public void shouldApplyAndRetainLimit() {
    Search<LongTestEntity, Long> next = searchImpl.limit(87);
    assertThat(next, not(sameInstance(search)));
    assertThat(next.limit(), is(87));
    assertThat(delegate(next).limit(), is(87));
    assertThat(searchImpl.limit(), is(nullValue()));
    assertThat(delegate(searchImpl).limit(), is(nullValue()));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchImplTest.java

示例6: shouldApplyAndRetainOffset

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Test
public void shouldApplyAndRetainOffset() {
    Search<LongTestEntity, Long> next = searchImpl.offset(87);
    assertThat(next, not(sameInstance(search)));
    assertThat(next.offset(), is(87));
    assertThat(delegate(next).offset(), is(87));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:SearchImplTest.java

示例7: shouldApplyAndRetainQuery

import com.threewks.gaetools.search.Search; //导入依赖的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

示例8: shouldApplyFieldOperation

import com.threewks.gaetools.search.Search; //导入依赖的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

示例9: shouldApplyOrderOperation

import com.threewks.gaetools.search.Search; //导入依赖的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)));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchImplTest.java

示例10: shouldApplyAndRetainAccuracy

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Test
public void shouldApplyAndRetainAccuracy() {
    Search<LongTestEntity, Long> next = searchImpl.accuracy(200);
    assertThat(next, not(sameInstance(search)));
    assertThat(next.accuracy(), is(200));
    assertThat(delegate(next).accuracy(), is(200));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:SearchImplTest.java

示例11: createSearch

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
private Search<T, String> createSearch(String name) {
    Search<T, String> search = search();
    search = search.limit(SEARCH_LIMIT);
    search = search.field("searchableText", Is.EqualTo, name.toUpperCase());

    return search;
}
 
开发者ID:monPlan,项目名称:AppleSeed,代码行数:8,代码来源:MonPlanRepository.java

示例12: order

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
@Override
public Search<T, K> order(String field, boolean ascending) {
    List<OrderComponent> sortOrder = new ArrayList<>(this.sortOrder);
    sortOrder.add(OrderComponent.forField(field, ascending));
    return createNewInstance(queryComponents, sortOrder, limit, offset, accuracy);
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:7,代码来源:SearchImpl.java

示例13: createNewInstance

import com.threewks.gaetools.search.Search; //导入依赖的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

示例14: SearchImpl

import com.threewks.gaetools.search.Search; //导入依赖的package包/类
protected SearchImpl(AbstractRepository<E, K> repository, com.threewks.gaetools.search.Search<E, Key<E>> searchRequest) {
    this.searchRequest = searchRequest;
    this.repository = repository;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:5,代码来源:SearchImpl.java

示例15: getSearchRequest

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


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