incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/5] git commit: Class not needed.
Date Wed, 31 Oct 2012 01:14:49 GMT
Class not needed.


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

Branch: refs/heads/0.2-dev
Commit: 022cc578018018e60cda9efe84c22aa39afa0766
Parents: 4b07cd1
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Oct 30 21:10:34 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 30 21:10:34 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/TopFieldDocsMerger.java |   73 ---------------
 1 files changed, 0 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/022cc578/src/blur-core/src/main/java/org/apache/blur/thrift/TopFieldDocsMerger.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/TopFieldDocsMerger.java b/src/blur-core/src/main/java/org/apache/blur/thrift/TopFieldDocsMerger.java
deleted file mode 100644
index 6adb02b..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/TopFieldDocsMerger.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.blur.thrift;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.utils.BlurExecutorCompletionService;
-import org.apache.blur.utils.ForkJoin.Merger;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Sort;
-import org.apache.lucene.search.TopDocs;
-import org.apache.lucene.search.TopFieldDocs;
-
-public class TopFieldDocsMerger implements Merger<TopFieldDocs> {
-
-  private static Log LOG = LogFactory.getLog(TopFieldDocsMerger.class);
-
-  private long _minimumNumberOfResults;
-  private long _maxQueryTime;
-  private Query _query;
-  private Filter _filter;
-  private Sort _sort;
-  private int _topN;
-
-  public TopFieldDocsMerger(long minimumNumberOfResults, long maxQueryTime, int topN) {
-    _minimumNumberOfResults = minimumNumberOfResults;
-    _maxQueryTime = maxQueryTime;
-    _topN = topN;
-  }
-
-  @Override
-  public TopFieldDocs merge(BlurExecutorCompletionService<TopFieldDocs> service) throws
BlurException {
-    List<TopFieldDocs> results = new ArrayList<TopFieldDocs>();
-    long total = 0;
-    while (service.getRemainingCount() > 0) {
-      Future<TopFieldDocs> future = service.poll(_maxQueryTime, TimeUnit.MILLISECONDS,
true, _query, _filter, _sort);
-      if (future != null) {
-        TopFieldDocs topFieldDocs = service.getResultThrowException(future, _query, _filter,
_sort);
-        total += topFieldDocs.totalHits;
-        results.add(topFieldDocs);
-        if (total >= _minimumNumberOfResults) {
-          // Called to stop execution of any other running queries.
-          service.cancelAll();
-          return merge(results);
-        }
-      } else {
-        LOG.info("Query timeout with max query time of [{0}] for query [{1}] filter [{2}]
sort [{3}].", _maxQueryTime, _query, _filter, _sort);
-        throw new BlurException("Query timeout with max query time of [" + _maxQueryTime
+ "] for query [" + _query + "] filter [" + _filter + "] sort [" + _sort + "].", null);
-      }
-    }
-    return merge(results);
-  }
-
-  private TopFieldDocs merge(List<TopFieldDocs> results) throws BlurException {
-    try {
-      TopDocs topDocs = TopDocs.merge(_sort, _topN, results.toArray(new TopDocs[]{}));
-      if (_sort == null) {
-        return new TopFieldDocs(topDocs.totalHits, topDocs.scoreDocs, null, topDocs.getMaxScore());
-      } else {
-        return (TopFieldDocs) topDocs;
-      }
-    } catch (IOException e) {
-      throw new BException("Unkown IOException", e);
-    }
-  }
-
-}


Mime
View raw message