本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}