incubator-blur-commits mailing list archives

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

Conflicts:
	blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java


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

Branch: refs/heads/master
Commit: af9637bf07630a56eba9eb6fc700cd76f97d3186
Parents: 63c60d9
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:56:45 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/af9637bf/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 9bf8acc..b750cba 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
@@ -109,7 +109,8 @@ public class BlurShardServer extends TableAdmin implements Iface {
       // Note: Querying the Shard Server directly if query.startTime == 0
       BlurUtil.setStartTime(blurQuery);
 
-      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);
@@ -125,8 +126,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