incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/4] git commit: Adding tracing to secure search.
Date Tue, 03 Feb 2015 15:25:21 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 9e9e8ed1b -> f8b2d4354


Adding tracing to secure search.


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

Branch: refs/heads/master
Commit: 115cfaf2d961546e08ab3d1d9a48f46d99757bcd
Parents: 9e9e8ed
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Feb 2 21:28:14 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Feb 2 21:28:14 2015 -0500

----------------------------------------------------------------------
 .../IndexSearcherCloseableSecureBase.java       | 57 +++++++++-----------
 1 file changed, 25 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/115cfaf2/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
b/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
index 86ee3ed..d3bfdda 100644
--- a/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
+++ b/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
@@ -17,7 +17,9 @@ package org.apache.blur.server;
  * the License.
  */
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
 
@@ -25,7 +27,12 @@ import lucene.security.index.AccessControlFactory;
 import lucene.security.search.SecureIndexSearcher;
 
 import org.apache.blur.lucene.search.IndexSearcherCloseable;
+import org.apache.blur.trace.Trace;
+import org.apache.blur.trace.Tracer;
+import org.apache.lucene.index.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.Collector;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.store.Directory;
 
 public abstract class IndexSearcherCloseableSecureBase extends SecureIndexSearcher implements
IndexSearcherCloseable {
@@ -40,37 +47,23 @@ public abstract class IndexSearcherCloseableSecureBase extends SecureIndexSearch
 
   @Override
   public abstract void close() throws IOException;
-  //
-  // protected void search(List<AtomicReaderContext> leaves, Weight weight,
-  // Collector collector) throws IOException {
-  // // TODO: should we make this
-  // // threaded...? the Collector could be sync'd?
-  // // always use single thread:
-  // for (AtomicReaderContext ctx : leaves) { // search each subreader
-  // Tracer trace = Trace.trace("search - internal", Trace.param("AtomicReader",
-  // ctx.reader()));
-  // try {
-  // try {
-  // collector.setNextReader(ctx);
-  // } catch (CollectionTerminatedException e) {
-  // // there is no doc of interest in this reader context
-  // // continue with the following leaf
-  // continue;
-  // }
-  // Scorer scorer = weight.scorer(ctx, !collector.acceptsDocsOutOfOrder(),
-  // true, ctx.reader().getLiveDocs());
-  // if (scorer != null) {
-  // try {
-  // scorer.score(collector);
-  // } catch (CollectionTerminatedException e) {
-  // // collection was terminated prematurely
-  // // continue with the following leaf
-  // }
-  // }
-  // } finally {
-  // trace.done();
-  // }
-  // }
-  // }
+
+  protected void search(List<AtomicReaderContext> leaves, Weight weight, Collector
collector) throws IOException {
+    // TODO: should we make this
+    // threaded...? the Collector could be sync'd?
+    // always use single thread:
+    for (AtomicReaderContext ctx : leaves) { // search each subreader
+      Tracer trace = Trace.trace("search - internal", Trace.param("AtomicReader", ctx.reader()));
+      try {
+        super.search(makeList(ctx), weight, collector);
+      } finally {
+        trace.done();
+      }
+    }
+  }
+
+  private List<AtomicReaderContext> makeList(AtomicReaderContext ctx) {
+    return Arrays.asList(ctx);
+  }
 
 }


Mime
View raw message