org.apache.lucene.search.QueryCachingPolicy.shouldCache()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(57)

本文整理了Java中org.apache.lucene.search.QueryCachingPolicy.shouldCache方法的一些代码示例,展示了QueryCachingPolicy.shouldCache的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryCachingPolicy.shouldCache方法的具体详情如下:
包路径:org.apache.lucene.search.QueryCachingPolicy
类名称:QueryCachingPolicy
方法名:shouldCache

QueryCachingPolicy.shouldCache介绍

[英]Whether the given Query is worth caching. This method will be called by the QueryCache to know whether to cache. It will first attempt to load a DocIdSet from the cache. If it is not cached yet and this method returns true then a cache entry will be generated. Otherwise an uncached scorer will be returned.
[中]给定的查询是否值得缓存。QueryCache将调用此方法以了解是否要缓存。它将首先尝试从缓存加载DocIdSet。如果它还没有被缓存,并且这个方法返回true,那么将生成一个缓存条目。否则将返回一个未缓存的得分手。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

if (policy.shouldCache(in.getQuery())) {
 docIdSet = cache(context);
 putIfAbsent(in.getQuery(), context, docIdSet, cacheHelper);

代码示例来源:origin: org.apache.lucene/lucene-core

if (policy.shouldCache(in.getQuery())) {
 docIdSet = cache(context);
 putIfAbsent(in.getQuery(), context, docIdSet, cacheHelper);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public boolean shouldCache(Query query) throws IOException {
  if (query.getClass() == TermQuery.class) {
    return false;
  }
  return in.shouldCache(query);
}

代码示例来源:origin: harbby/presto-connectors

@Override
public boolean shouldCache(Query query, LeafReaderContext ctx) throws IOException {
  if (query.getClass() == TermQuery.class) {
    return false;
  }
  return in.shouldCache(query, ctx);
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private boolean shouldCache(LeafReaderContext context) throws IOException {
 return cacheEntryHasReasonableWorstCaseSize(ReaderUtil.getTopLevelContext(context).reader().maxDoc())
   && policy.shouldCache(in.getQuery(), context);
}

代码示例来源:origin: harbby/presto-connectors

private boolean shouldCache(LeafReaderContext context) throws IOException {
 return cacheEntryHasReasonableWorstCaseSize(ReaderUtil.getTopLevelContext(context).reader().maxDoc())
   && policy.shouldCache(in.getQuery(), context);
}

代码示例来源:origin: harbby/presto-connectors

if (docIdSet != null) {
 hitCount++;
} else if (policy.shouldCache(query, context)) {
 missCount++;
 final Scorer scorer = weight.scorer(context);

代码示例来源:origin: org.infinispan/infinispan-embedded-query

if (docIdSet != null) {
 hitCount++;
} else if (policy.shouldCache(query, context)) {
 missCount++;
 final Scorer scorer = weight.scorer(context);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

if (policy.shouldCache(in.getQuery())) {
 docIdSet = cache(context);
 putIfAbsent(in.getQuery(), context, docIdSet, cacheHelper);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

if (policy.shouldCache(in.getQuery())) {
 docIdSet = cache(context);
 putIfAbsent(in.getQuery(), context, docIdSet, cacheHelper);

相关文章

微信公众号

最新文章

更多