incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [5/7] git commit: Ensuring that the cache doesn't contain data.
Date Tue, 17 Dec 2013 13:58:45 GMT
Ensuring that the cache doesn't contain data.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/25ccd0df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/25ccd0df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/25ccd0df

Branch: refs/heads/apache-blur-0.2
Commit: 25ccd0df6173cc5446c826adaac578ffc508a5a9
Parents: 7d834f1
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Dec 17 08:49:13 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Dec 17 08:49:13 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/blur/thrift/BlurShardServer.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/25ccd0df/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index c982534..2c364ee 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -106,7 +106,8 @@ public class BlurShardServer extends TableAdmin implements Iface {
         }
       }
 
-      if (blurQuery.useCacheIfPresent) {
+      if (blurQuery.useCacheIfPresent && selector == null) {
+        // Selector has to be null because we might cache data if it's not.
         LOG.debug("Using cache for query [{0}] on table [{1}].", blurQuery, table);
         QueryCacheKey key = QueryCache.getNormalizedBlurQueryKey(table, blurQuery);
         QueryCacheEntry queryCacheEntry = _queryCache.get(key);
@@ -122,8 +123,12 @@ public class BlurShardServer extends TableAdmin implements Iface {
       try {
         AtomicLongArray facetCounts = BlurUtil.getAtomicLongArraySameLengthAsList(blurQuery.facets);
         hitsIterable = _indexManager.query(table, blurQuery, facetCounts);
-        return _queryCache.cache(table, original,
-            BlurUtil.convertToHits(hitsIterable, blurQuery, facetCounts, _dataFetch, blurQuery.selector,
this, table));
+        BlurResults blurResults = BlurUtil.convertToHits(hitsIterable, blurQuery, facetCounts,
_dataFetch,
+            blurQuery.selector, this, table);
+        if (selector != null) {
+          return blurResults;
+        }
+        return _queryCache.cache(table, original, blurResults);
       } catch (BlurException e) {
         throw e;
       } catch (Exception e) {


Mime
View raw message