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


Java Search.getQueryFactory方法代码示例

本文整理汇总了Java中org.infinispan.query.Search.getQueryFactory方法的典型用法代码示例。如果您正苦于以下问题:Java Search.getQueryFactory方法的具体用法?Java Search.getQueryFactory怎么用?Java Search.getQueryFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.infinispan.query.Search的用法示例。


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

示例1: main

import org.infinispan.query.Search; //导入方法依赖的package包/类
public static void main(String[] args) {
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.indexing().index(Index.ALL)
      .addProperty("default.directory_provider", "ram")
      .addProperty("lucene_version", "LUCENE_CURRENT");
   // Construct a simple local cache manager with default configuration
   DefaultCacheManager cacheManager = new DefaultCacheManager(builder.build());
   // Obtain the default cache
   Cache<String, Person> cache = cacheManager.getCache();
   // Store some entries
   cache.put("person1", new Person("William", "Shakespeare"));
   cache.put("person2", new Person("William", "Wordsworth"));
   cache.put("person3", new Person("John", "Milton"));
   // Obtain a query factory for the cache
   QueryFactory queryFactory = Search.getQueryFactory(cache);
   // Construct a query
   Query query = queryFactory.from(Person.class).having("name").eq("William").toBuilder().build();
   // Execute the query
   List<Person> matches = query.list();
   // List the results
   matches.forEach(person -> System.out.printf("Match: %s", person));
   // Stop the cache manager and release all resources
   cacheManager.stop();
}
 
开发者ID:infinispan,项目名称:infinispan-simple-tutorials,代码行数:25,代码来源:InfinispanQuery.java

示例2: getBeerByIbuBetweenIQ

import org.infinispan.query.Search; //导入方法依赖的package包/类
public List<Beer> getBeerByIbuBetweenIQ(double low, double high){
    QueryFactory queryFactory = Search.getQueryFactory(cache);
    org.infinispan.query.dsl.Query infinispanQuery =
            queryFactory.from(Beer.class)
                    .orderBy("ibu", SortOrder.ASC)
                    .having("ibu")
                    .between(low,high)
                    .build();
    return infinispanQuery.list();
}
 
开发者ID:briantward,项目名称:jdg-lab,代码行数:11,代码来源:IndexedCacheBeerService.java

示例3: getAllBeers

import org.infinispan.query.Search; //导入方法依赖的package包/类
public List<Beer> getAllBeers(boolean desc) {
    QueryFactory queryFactory = Search.getQueryFactory(cache);
    org.infinispan.query.dsl.QueryBuilder infinispanQueryBuilder =
            queryFactory.from(Beer.class);

    if(desc){
        infinispanQueryBuilder.orderBy("id", SortOrder.DESC);
    }
    org.infinispan.query.dsl.Query infinispanQuery = infinispanQueryBuilder.build();
    return infinispanQuery.list();
}
 
开发者ID:briantward,项目名称:jdg-lab,代码行数:12,代码来源:CacheBeerService.java

示例4: getBeerByWildcardDescription

import org.infinispan.query.Search; //导入方法依赖的package包/类
public List<Beer> getBeerByWildcardDescription(String description){
    QueryFactory queryFactory = Search.getQueryFactory(cache);
    org.infinispan.query.dsl.Query infinispanQuery =
            queryFactory.from(Beer.class)
                    .having("description")
                    .like("%" + description + "%")
                    .build();
    return infinispanQuery.list();
}
 
开发者ID:briantward,项目名称:jdg-lab,代码行数:10,代码来源:CacheBeerService.java

示例5: InventoryServiceIspn

import org.infinispan.query.Search; //导入方法依赖的package包/类
InventoryServiceIspn(Cache<String, Object> resource, Cache<String, Object> resourceType, String configPath, InventoryStatsMBean inventoryStatsMBean, ScrapeConfig scrapeConfig, File scrapeLocation) {
    this.resource = resource;
    this.resourceType = resourceType;
    qResource = Search.getQueryFactory(resource);
    qResourceType = Search.getQueryFactory(resourceType);
    this.configPath = Paths.get(configPath);
    this.inventoryStatsMBean = inventoryStatsMBean;
    this.scrapeConfig = scrapeConfig;
    this.scrapeLocation = scrapeLocation;
}
 
开发者ID:hawkular,项目名称:hawkular-commons,代码行数:11,代码来源:InventoryServiceIspn.java

示例6: init

import org.infinispan.query.Search; //导入方法依赖的package包/类
public void init() {
    backend = IspnCacheManager.getCacheManager().getCache("backend");
    if (backend == null) {
        log.error("Ispn backend cache not found. Check configuration.");
        throw new RuntimeException("backend cache not found");
    }
    queryFactory = Search.getQueryFactory(backend);
}
 
开发者ID:hawkular,项目名称:hawkular-alerts,代码行数:9,代码来源:IspnActionsServiceImpl.java


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