本文整理汇总了Java中org.infinispan.query.SearchManager类的典型用法代码示例。如果您正苦于以下问题:Java SearchManager类的具体用法?Java SearchManager怎么用?Java SearchManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchManager类属于org.infinispan.query包,在下文中一共展示了SearchManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBeerByIbuBetween
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public List<Beer> getBeerByIbuBetween(double low, double high){
SearchManager searchManager = Search.getSearchManager(cache);
QueryBuilder qb = searchManager.buildQueryBuilderForClass(Beer.class).get();
Query query = qb.bool()
.must( qb.range().onField("ibu").above(low).createQuery())
.must( qb.range().onField("ibu").below(high).createQuery())
.createQuery();
List<Beer> result = (List<Beer>)(List)searchManager.getQuery(query, Beer.class).list();
return result;
}
开发者ID:briantward,项目名称:jdg-lab,代码行数:11,代码来源:IndexedCacheBeerService.java
示例2: getAllBeers
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public List<Beer> getAllBeers(boolean desc) {
SearchManager searchManager = Search.getSearchManager(cache);
QueryBuilder qb = searchManager.buildQueryBuilderForClass(Beer.class).get();
Query query = qb.all().createQuery();
CacheQuery cq = searchManager.getQuery(query); //cq is a CacheQuery wrapper of a Lucene query
if(desc){
Sort sort = new Sort(new SortField("id", SortField.Type.LONG));
cq.sort(sort);
}
List<Beer> result = (List<Beer>)(List)cq.list();
return result;
}
开发者ID:briantward,项目名称:jdg-lab,代码行数:13,代码来源:IndexedCacheBeerService.java
示例3: getBeerByFuzzyMatchDescription
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public List<Beer> getBeerByFuzzyMatchDescription(String description){
SearchManager searchManager = Search.getSearchManager(cache);
QueryBuilder qb = searchManager.buildQueryBuilderForClass(Beer.class).get();
Query query = qb.keyword()
.fuzzy()
.withPrefixLength(1)
.onField("description")
.matching(description)
.createQuery();
List<Beer> items = (List<Beer>)(List)searchManager.getQuery(query, Beer.class).list();
return items;
}
开发者ID:briantward,项目名称:jdg-lab,代码行数:13,代码来源:IndexedCacheBeerService.java
示例4: getBeerByWildcardDescription
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public List<Beer> getBeerByWildcardDescription(String description){
SearchManager searchManager = Search.getSearchManager(cache);
QueryBuilder qb = searchManager.buildQueryBuilderForClass(Beer.class).get();
Query query = qb.keyword()
.wildcard()
.onField("description")
.matching(description + "*")
.createQuery();
List<Beer> items = (List<Beer>)(List)searchManager.getQuery(query, Beer.class).list();
return items;
}
开发者ID:briantward,项目名称:jdg-lab,代码行数:12,代码来源:IndexedCacheBeerService.java
示例5: getBeerByIbuBetween
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public List<Beer> getBeerByIbuBetween(double low, double high){
SearchManager searchManager = Search.getSearchManager(cache);
QueryBuilder qb = searchManager.buildQueryBuilderForClass(Beer.class).get();
Query query = qb.bool()
.must( qb.range().onField("ibu").above(low).createQuery())
.must( qb.range().onField("ibu").below(high).createQuery())
.createQuery();
List<Beer> result = (List<Beer>)(List)searchManager.getQuery(query, Beer.class).list();
return result;
}
开发者ID:briantward,项目名称:jdg-lab,代码行数:12,代码来源:CacheBeerService.java
示例6: performSearch
import org.infinispan.query.SearchManager; //导入依赖的package包/类
private static List<Object> performSearch(Condition where, String cacheName, ObjectConnection connection)
throws TranslatorException {
LogManager.logTrace(LogConstants.CTX_CONNECTOR,
"Using Lucene Searching."); //$NON-NLS-1$
Class<?> type = connection.getType(cacheName);
//Map<?, ?> cache,
SearchManager searchManager = Search
.getSearchManager((Cache<?, ?>) connection.getCacheContainer().getCache(cacheName) );
QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(type).get();
BooleanJunction<BooleanJunction> junction = queryBuilder.bool();
boolean createdQueries = buildQueryFromWhereClause(where,
junction, queryBuilder);
Query query = null;
if (createdQueries) {
query = junction.createQuery();
} else {
query = queryBuilder.all().createQuery();
}
CacheQuery cacheQuery = searchManager.getQuery(query, type); // rootNodeType
List<Object> results = cacheQuery.list();
if (results == null || results.isEmpty()) {
return Collections.emptyList();
}
return results;
}
开发者ID:kenweezy,项目名称:teiid,代码行数:36,代码来源:LuceneSearch.java
示例7: createQueryAdapter
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public <T> QueryAdapter<T> createQueryAdapter(Class<T> entityClass) {
SearchManager searchManager = Search.getSearchManager(getCache(entityClass));
return new InfinispanEmbeddedQueryAdapter<>(searchManager);
}
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:5,代码来源:InfinispanEmbeddedDatasourceMapper.java
示例8: InfinispanEmbeddedQueryAdapter
import org.infinispan.query.SearchManager; //导入依赖的package包/类
public InfinispanEmbeddedQueryAdapter(SearchManager searchManager) {
this.searchManager = searchManager;
}
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:4,代码来源:InfinispanEmbeddedDatasourceMapper.java
示例9: testIndexingWithWrapper
import org.infinispan.query.SearchManager; //导入依赖的package包/类
@Test
public void testIndexingWithWrapper() throws Exception {
User user = User.newBuilder().build();
user.setName("Alice");
user.setFavoriteNumber(12);
addToCache(user);
final HashMap<String,String> hardDrives
= new HashMap<String, String>() {{put("STCD00502", "SEAGATE");put("STA045M", "SEAGATE");}};
DeviceList deviceList = DeviceList.newBuilder().build();
deviceList.setDevices(new ArrayList<Map<String, String>>() {{
add(hardDrives);
}});
deviceList.setName("my devices");
addToCache(deviceList);
WebPage page = WebPage.newBuilder().build();
page.setKey("http://www.test.com");
Map<String,String> outlinks = new HashMap<>();
outlinks.put("1", "http://www.example.com");
page.setOutlinks(outlinks);
addToCache(page);
SearchManager sm = Search.getSearchManager(cache);
Query luceneQuery = sm.buildQueryBuilderForClass(GenericData.Record.class)
.get()
.keyword()
.onField("name")
.ignoreFieldBridge()
.ignoreAnalyzer()
.matching("Alice")
.createQuery();
List<Object> list = sm.getQuery(luceneQuery).list();
assertEquals(1, list.size());
assertEquals(list.get(0), toGeneric(user));
luceneQuery = NumericRangeQuery.newIntRange("favorite_number", 8, 0, 12, true, true);
list = sm.getQuery(luceneQuery).list();
assertEquals(1, list.size());
assertEquals(list.get(0), toGeneric(user));
luceneQuery = sm.buildQueryBuilderForClass(GenericData.Record.class)
.get()
.keyword()
.onField("name")
.ignoreFieldBridge()
.ignoreAnalyzer()
.matching("Bob")
.createQuery();
list = sm.getQuery(luceneQuery).list();
assertEquals(0, list.size());
luceneQuery = sm.buildQueryBuilderForClass(GenericData.Record.class)
.get()
.keyword()
.onField("devices" + Support.DELIMITER+"0")
.ignoreFieldBridge()
.ignoreAnalyzer()
.matching("STCD00502" + Support.DELIMITER + "SEAGATE")
.createQuery();
list = sm.getQuery(luceneQuery).list();
assertEquals(1, list.size());
assertEquals(list.get(0),toGeneric(deviceList));
luceneQuery = sm.buildQueryBuilderForClass(GenericData.Record.class)
.get()
.keyword()
.onField("outlinks")
.ignoreFieldBridge()
.ignoreAnalyzer()
.matching("1" + Support.DELIMITER+"http://www.example.com")
.createQuery();
list = sm.getQuery(luceneQuery).list();
assertEquals(1,list.size());
assertEquals(list.get(0),toGeneric(page));
}
开发者ID:leads-project,项目名称:infinispan-avro,代码行数:78,代码来源:AvroWrapperIndexingTest.java
注:本文中的org.infinispan.query.SearchManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论