Ejemplo n.º 1
0
 synchronized DocIdSet get(Query key, LeafReaderContext context) {
   assert key instanceof BoostQuery == false;
   assert key instanceof ConstantScoreQuery == false;
   final Object readerKey = context.reader().getCoreCacheKey();
   final LeafCache leafCache = cache.get(readerKey);
   if (leafCache == null) {
     onMiss(readerKey, key);
     return null;
   }
   // this get call moves the query to the most-recently-used position
   final Query singleton = uniqueQueries.get(key);
   if (singleton == null) {
     onMiss(readerKey, key);
     return null;
   }
   final DocIdSet cached = leafCache.get(singleton);
   if (cached == null) {
     onMiss(readerKey, singleton);
   } else {
     onHit(readerKey, singleton);
   }
   return cached;
 }