incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: The search call mostly works! More fixes to come.
Date Tue, 30 Oct 2012 13:03:45 GMT
Updated Branches:
  refs/heads/0.2-dev 948366d71 -> afaa6c403


The search call mostly works!  More fixes to come.


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

Branch: refs/heads/0.2-dev
Commit: afaa6c403125540a71a354895bec75cf2f8f4edd
Parents: 948366d
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Oct 30 09:03:12 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 30 09:03:12 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/BlurShardServer.java    |    5 +--
 .../blur/thrift/ThriftBlurControllerServer.java    |    6 +++-
 .../apache/blur/thrift/ThriftBlurShardServer.java  |    8 ++++-
 .../java/org/apache/blur/thrift/ThriftServer.java  |   23 ++++++++-------
 .../main/java/org/apache/blur/utils/BlurUtil.java  |   22 +++++++++++++-
 .../lucene/serializer/AbtractQueryWritable.java    |    4 ++-
 .../lucene/serializer/BooleanQueryWritable.java    |    2 +-
 .../blur/lucene/serializer/FuzzyQueryWritable.java |    2 +-
 .../apache/blur/lucene/serializer/QUERY_TYPE.java  |    2 +-
 .../blur/lucene/serializer/QueryWritable.java      |    9 ++++--
 .../blur/lucene/serializer/TermQueryWritable.java  |    2 +-
 11 files changed, 59 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index 727e434..1cfb9d4 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -417,7 +417,7 @@ public class BlurShardServer extends TableAdmin implements Iface {
         Future<TopFieldDocs> future = _searchExecutor.submit(new SearchCallable(searcher,
after, query, filter, sort, numberToFetch, doDocScores, doMaxScore));
         futures.add(future);
       }
-      
+
       List<TopFieldDocs> result = new ArrayList<TopFieldDocs>(futures.size());
       for (Future<TopFieldDocs> future : futures) {
         result.add(future.get());
@@ -485,8 +485,7 @@ public class BlurShardServer extends TableAdmin implements Iface {
   }
 
   private SessionInfo getSessionInfo(Session session) {
-    // TODO Auto-generated method stub
-    return null;
+    return sessions.get(session.getSessionId());
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
index 8bc7b99..a26cc5c 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
@@ -53,7 +53,9 @@ import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
 import org.apache.blur.manager.indexserver.BlurServerShutDown;
 import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
 import org.apache.blur.metrics.BlurMetrics;
+import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.thrift.generated.Blur.Processor;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.zookeeper.ZkUtils;
 import org.apache.hadoop.conf.Configuration;
@@ -123,6 +125,8 @@ public class ThriftBlurControllerServer extends ThriftServer {
     Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics, controllerServer,
Iface.class);
 
     int threadCount = configuration.getInt(BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT, 32);
+    
+    Processor<Iface> processor = new Blur.Processor<Iface>(iface);
 
     final ThriftBlurControllerServer server = new ThriftBlurControllerServer();
     server.setNodeName(nodeName);
@@ -130,7 +134,7 @@ public class ThriftBlurControllerServer extends ThriftServer {
     server.setBindAddress(bindAddress);
     server.setBindPort(bindPort);
     server.setThreadCount(threadCount);
-    server.setIface(iface);
+    server.setProcessor(processor);
 
     int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT));
     final HttpJettyServer httpServer;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 02cbee1..cbfc81a 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -62,7 +62,9 @@ import org.apache.blur.store.blockcache.BlockDirectory;
 import org.apache.blur.store.blockcache.BlockDirectoryCache;
 import org.apache.blur.store.blockcache.Cache;
 import org.apache.blur.store.buffer.BufferStore;
-import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.thrift.generated.Lucene;
+import org.apache.blur.thrift.generated.Lucene.Iface;
+import org.apache.blur.thrift.generated.Lucene.Processor;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.zookeeper.ZkUtils;
 import org.apache.hadoop.conf.Configuration;
@@ -210,14 +212,16 @@ public class ThriftBlurShardServer extends ThriftServer {
     Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics, shardServer, Iface.class);
 
     int threadCount = configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT, 32);
+    
+    Processor<Iface> processor = new Lucene.Processor<Iface>(iface);
 
     final ThriftBlurShardServer server = new ThriftBlurShardServer();
     server.setNodeName(nodeName);
     server.setBindAddress(bindAddress);
     server.setBindPort(bindPort);
     server.setThreadCount(threadCount);
-    server.setIface(iface);
     server.setConfiguration(configuration);
+    server.setProcessor(processor);
 
     // This will shutdown the server when the correct path is set in zk
     BlurShutdown shutdown = new BlurShutdown() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
index 30d54e9..8fd5920 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
@@ -31,6 +31,7 @@ import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
 import org.apache.blur.thrift.ExecutorServicePerMethodCallThriftServer.Args;
 import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.thrift.TBaseProcessor;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.transport.TNonblockingServerSocket;
 import org.apache.thrift.transport.TTransportException;
@@ -41,7 +42,6 @@ public class ThriftServer {
   private static final Log LOG = LogFactory.getLog(ThriftServer.class);
 
   private String _nodeName;
-  private Iface _iface;
   private TServer _server;
   private boolean _closed;
   private BlurConfiguration _configuration;
@@ -52,6 +52,7 @@ public class ThriftServer {
   private ExecutorService _executorService;
   private ExecutorService _queryExexutorService;
   private ExecutorService _mutateExecutorService;
+  private TBaseProcessor<?> _processor;
 
   public synchronized void close() {
     if (!_closed) {
@@ -76,11 +77,11 @@ public class ThriftServer {
   }
 
   public void start() throws TTransportException {
-    Blur.Processor<Blur.Iface> processor = new Blur.Processor<Blur.Iface>(_iface);
+//    Blur.Processor<Blur.Iface> processor = new Blur.Processor<Blur.Iface>(_iface);
     TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(getBindInetSocketAddress(_configuration));
 
     Args args = new Args(serverTransport);
-    args.processor(processor);
+    args.processor(_processor);
     _executorService = Executors.newThreadPool("thrift-processors", _threadCount);
     args.executorService(_executorService);
     Map<String, ExecutorService> methodCallsToExecutorService = new HashMap<String,
ExecutorService>();
@@ -106,14 +107,6 @@ public class ThriftServer {
     return str;
   }
 
-  public Iface getIface() {
-    return _iface;
-  }
-
-  public void setIface(Iface iface) {
-    this._iface = iface;
-  }
-
   public String getNodeName() {
     return _nodeName;
   }
@@ -157,4 +150,12 @@ public class ThriftServer {
   public void setShutdown(BlurShutdown shutdown) {
     this._shutdown = shutdown;
   }
+  
+  public TBaseProcessor<?> getProcessor() {
+    return _processor;
+  }
+
+  public void setProcessor(TBaseProcessor<?> processor) {
+    this._processor = processor;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index 05db8bd..df6ceec 100644
--- a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -713,6 +713,9 @@ public class BlurUtil {
   }
 
   public static List<SortField> convert(org.apache.lucene.search.SortField[] fields)
{
+    if (fields == null) {
+      return null;
+    }
     List<SortField> result = new ArrayList<SortField>(fields.length);
     for (int i = 0; i < fields.length; i++) {
       result.add(convert(fields[i]));
@@ -721,6 +724,9 @@ public class BlurUtil {
   }
 
   public static SortField convert(org.apache.lucene.search.SortField sortField) {
+    if (sortField == null) {
+      return null;
+    }
     SortField result = new SortField();
     result.setField(sortField.getField());
     result.setReverse(sortField.getReverse());
@@ -729,6 +735,9 @@ public class BlurUtil {
   }
 
   public static ScoreDoc convert(org.apache.lucene.search.ScoreDoc scoreDoc) {
+    if (scoreDoc == null) {
+      return null;
+    }
     ScoreDoc result = new ScoreDoc();
     result.setDocLocation(new DocLocation(scoreDoc.doc, scoreDoc.shardIndex));
     result.setScore(scoreDoc.score);
@@ -736,6 +745,9 @@ public class BlurUtil {
   }
 
   public static ScoreDoc convert(org.apache.lucene.search.FieldDoc fieldDoc) {
+    if (fieldDoc == null) {
+      return null;
+    }
     ScoreDoc result = new ScoreDoc();
     result.setDocLocation(new DocLocation(fieldDoc.doc, fieldDoc.shardIndex));
     result.setFields(convert(fieldDoc.fields));
@@ -744,6 +756,9 @@ public class BlurUtil {
   }
 
   public static SortType convert(Type type) {
+    if (type == null) {
+      return null;
+    }
     switch (type) {
     case BYTE:
       return SortType.BYTE;
@@ -773,7 +788,9 @@ public class BlurUtil {
   }
 
   public static List<ByteBuffer> convert(Object[] fields) {
-    throw new RuntimeException("Not supported YET!");
+//    throw new RuntimeException("Not supported YET!");
+    LOG.error("Not supported YET!");
+    return null;
   }
 
   public static Query getQuery(QueryArgs queryArgs) throws IOException {
@@ -799,6 +816,9 @@ public class BlurUtil {
   }
 
   public static org.apache.lucene.search.ScoreDoc convert(org.apache.blur.thrift.generated.ScoreDoc
scoreDoc) {
+    if (scoreDoc == null) {
+      return null;
+    }
     return new org.apache.lucene.search.ScoreDoc(scoreDoc.docLocation.doc, (float) scoreDoc.score,
scoreDoc.docLocation.shardIndex);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/AbtractQueryWritable.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/AbtractQueryWritable.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/AbtractQueryWritable.java
index afd78c8..0e0fb71 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/AbtractQueryWritable.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/AbtractQueryWritable.java
@@ -4,8 +4,10 @@ package org.apache.blur.lucene.serializer;
 import org.apache.hadoop.io.Writable;
 import org.apache.lucene.search.Query;
 
-public abstract class AbtractQueryWritable implements Writable {
+public abstract class AbtractQueryWritable<T extends Query> implements Writable {
   
   public abstract Query getQuery();
+  
+  public abstract void setQuery(T query);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/BooleanQueryWritable.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/BooleanQueryWritable.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/BooleanQueryWritable.java
index 9cedb91..f785edb 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/BooleanQueryWritable.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/BooleanQueryWritable.java
@@ -7,7 +7,7 @@ import java.io.IOException;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 
-public class BooleanQueryWritable extends AbtractQueryWritable {
+public class BooleanQueryWritable extends AbtractQueryWritable<BooleanQuery> {
 
   private BooleanQuery query;
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/FuzzyQueryWritable.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/FuzzyQueryWritable.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/FuzzyQueryWritable.java
index 174746e..b63f6c6 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/FuzzyQueryWritable.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/FuzzyQueryWritable.java
@@ -8,7 +8,7 @@ import java.lang.reflect.Field;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.FuzzyQuery;
 
-public class FuzzyQueryWritable extends AbtractQueryWritable {
+public class FuzzyQueryWritable extends AbtractQueryWritable<FuzzyQuery> {
 
   private FuzzyQuery query;
   private static Field maxExpansionsField;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QUERY_TYPE.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QUERY_TYPE.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QUERY_TYPE.java
index 1b980cc..6fb9b42 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QUERY_TYPE.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QUERY_TYPE.java
@@ -98,7 +98,7 @@ public enum QUERY_TYPE {
     }
   }
   
-  public static AbtractQueryWritable lookupQueryWritable(QUERY_TYPE type) {
+  public static AbtractQueryWritable<?> lookupQueryWritable(QUERY_TYPE type) {
     switch (type) {
     case BOOLEAN:
       return new BooleanQueryWritable();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QueryWritable.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QueryWritable.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QueryWritable.java
index 0ed4f60..e00bdbd 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QueryWritable.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/QueryWritable.java
@@ -6,7 +6,7 @@ import java.io.IOException;
 
 import org.apache.lucene.search.Query;
 
-public class QueryWritable extends AbtractQueryWritable {
+public class QueryWritable extends AbtractQueryWritable<Query> {
 
   private Query query;
   private QUERY_TYPE lookup;
@@ -33,18 +33,21 @@ public class QueryWritable extends AbtractQueryWritable {
     return lookup;
   }
 
+  @SuppressWarnings("unchecked")
   @Override
   public void write(DataOutput out) throws IOException {
     out.write(lookup.getType());
-    AbtractQueryWritable writable = QUERY_TYPE.lookupQueryWritable(lookup);
+    AbtractQueryWritable<Query> writable = (AbtractQueryWritable<Query>) QUERY_TYPE.lookupQueryWritable(lookup);
+    writable.setQuery(query);
     writable.write(out);
   }
 
+  @SuppressWarnings("unchecked")
   @Override
   public void readFields(DataInput in) throws IOException {
     byte b = in.readByte();
     lookup = QUERY_TYPE.lookup(b);
-    AbtractQueryWritable writable = QUERY_TYPE.lookupQueryWritable(lookup);
+    AbtractQueryWritable<Query> writable = (AbtractQueryWritable<Query>) QUERY_TYPE.lookupQueryWritable(lookup);
     writable.readFields(in);
     query = writable.getQuery();
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/afaa6c40/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/TermQueryWritable.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/TermQueryWritable.java
b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/TermQueryWritable.java
index 8a79102..7a05a23 100644
--- a/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/TermQueryWritable.java
+++ b/src/blur-store/src/main/java/org/apache/blur/lucene/serializer/TermQueryWritable.java
@@ -7,7 +7,7 @@ import java.io.IOException;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.TermQuery;
 
-public class TermQueryWritable extends AbtractQueryWritable {
+public class TermQueryWritable extends AbtractQueryWritable<TermQuery> {
 
   private TermQuery query;
 


Mime
View raw message