incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [78/92] [abbrv] git commit: Code cleanup, removing duplicate classes.
Date Tue, 11 Jun 2013 02:42:04 GMT
Code cleanup, removing duplicate classes.


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

Branch: refs/heads/master
Commit: 7a6a9807b1e3512ceb7ff1edbb61f1aed7c69da4
Parents: afa0b38
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Jun 9 20:24:05 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Jun 9 20:24:05 2013 -0400

----------------------------------------------------------------------
 .../apache/blur/manager/BlurQueryChecker.java   |    2 +-
 .../org/apache/blur/manager/IndexManager.java   |    2 +-
 .../indexserver/AbstractIndexServer.java        |    4 +-
 .../indexserver/DistributedIndexServer.java     |    3 +-
 .../results/BlurResultIterableMultiple.java     |    4 +-
 .../results/BlurResultIterableSimple.java       |    4 +-
 .../org/apache/blur/utils/BlurConstants.java    |  117 -
 .../java/org/apache/blur/utils/BlurUtil.java    |  104 +-
 .../org/apache/blur/utils/PrimeDocCache.java    |   90 -
 ...lurResultPeekableIteratorComparatorTest.java |    5 +-
 .../org/apache/blur/analysis/BlurAnalyzer.java  |    8 +-
 .../org/apache/blur/util/BlurConstants.java     |   27 -
 .../apache/blur/store/hdfs/BlurLockFactory.java |    2 +-
 .../org/apache/blur/thrift/util/words.txt       | 7851 ++++++++++++++++++
 blur-thrift/src/main/resources/words.txt        | 7851 ------------------
 .../org/apache/blur/utils/BlurConstants.java    |  103 +
 16 files changed, 8030 insertions(+), 8147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java b/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
index dbf0477..23a232b 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
@@ -25,7 +25,7 @@ import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.thrift.generated.BlurQuery;
 import org.apache.blur.thrift.generated.Selector;
-import org.apache.blur.util.BlurConstants;
+import org.apache.blur.utils.BlurConstants;
 
 /**
  * The {@link BlurQueryChecker} class check the {@link BlurQuery} for valid

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
index 967c100..f28e3d4 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/IndexManager.java
@@ -264,7 +264,7 @@ public class IndexManager {
         query.add(new TermQuery(new Term(ROW_ID, rowId)), Occur.MUST);
       } else {
         query.add(new TermQuery(new Term(ROW_ID, rowId)), Occur.MUST);
-        query.add(new TermQuery(BlurConstants.PRIME_DOC_TERM), Occur.MUST);
+        query.add(new TermQuery(BlurUtil.PRIME_DOC_TERM), Occur.MUST);
       }
       TopDocs topDocs = searcher.search(query, 1);
       if (topDocs.totalHits > 1) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/indexserver/AbstractIndexServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/AbstractIndexServer.java
b/blur-core/src/main/java/org/apache/blur/manager/indexserver/AbstractIndexServer.java
index 3644d96..db1599c 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/AbstractIndexServer.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/AbstractIndexServer.java
@@ -22,7 +22,7 @@ import java.util.Map;
 import org.apache.blur.manager.IndexServer;
 import org.apache.blur.manager.writer.BlurIndex;
 import org.apache.blur.server.IndexSearcherClosable;
-import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.utils.BlurUtil;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.TermQuery;
@@ -66,7 +66,7 @@ public abstract class AbstractIndexServer implements IndexServer {
 
   private long getRowCount(IndexReader indexReader) throws IOException {
     IndexSearcher searcher = new IndexSearcher(indexReader);
-    TopDocs topDocs = searcher.search(new TermQuery(BlurConstants.PRIME_DOC_TERM), 1);
+    TopDocs topDocs = searcher.search(new TermQuery(BlurUtil.PRIME_DOC_TERM), 1);
     return topDocs.totalHits;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
index c86eeae..58393f8 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
@@ -70,7 +70,6 @@ import org.apache.blur.store.hdfs.BlurLockFactory;
 import org.apache.blur.store.hdfs.HdfsDirectory;
 import org.apache.blur.thrift.generated.ShardState;
 import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.utils.BlurConstants;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.zookeeper.WatchChildren;
 import org.apache.blur.zookeeper.WatchChildren.OnChange;
@@ -447,7 +446,7 @@ public class DistributedIndexServer extends AbstractIndexServer {
     Path tablePath = new Path(getTableDescriptor(table).tableUri);
     Path hdfsDirPath = new Path(tablePath, shard);
 
-    BlurLockFactory lockFactory = new BlurLockFactory(_configuration, hdfsDirPath, _nodeName,
BlurConstants.getPid());
+    BlurLockFactory lockFactory = new BlurLockFactory(_configuration, hdfsDirPath, _nodeName,
BlurUtil.getPid());
 
     Directory directory = new HdfsDirectory(_configuration, hdfsDirPath);
     directory.setLockFactory(lockFactory);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableMultiple.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableMultiple.java
b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableMultiple.java
index 1a911c3..8d84395 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableMultiple.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableMultiple.java
@@ -27,7 +27,7 @@ import java.util.TreeMap;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.thrift.generated.BlurResult;
-import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.utils.BlurUtil;
 import org.apache.hadoop.io.IOUtils;
 
 
@@ -96,7 +96,7 @@ public class BlurResultIterableMultiple implements BlurResultIterable {
 
     @Override
     public BlurResult next() {
-      Collections.sort(iterators, BlurConstants.HITS_PEEKABLE_ITERATOR_COMPARATOR);
+      Collections.sort(iterators, BlurUtil.HITS_PEEKABLE_ITERATOR_COMPARATOR);
       return fetchResult(iterators.get(0).next());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableSimple.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableSimple.java
b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableSimple.java
index 3158576..ee89959 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableSimple.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/results/BlurResultIterableSimple.java
@@ -24,7 +24,7 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.blur.thrift.generated.BlurResult;
-import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.utils.BlurUtil;
 
 
 public class BlurResultIterableSimple implements BlurResultIterable {
@@ -34,7 +34,7 @@ public class BlurResultIterableSimple implements BlurResultIterable {
   private long skipTo;
 
   public BlurResultIterableSimple(String shard, List<BlurResult> hits) {
-    Collections.sort(hits, BlurConstants.HITS_COMPARATOR);
+    Collections.sort(hits, BlurUtil.HITS_COMPARATOR);
     this.results = hits;
     this.shardInfo = new TreeMap<String, Long>();
     this.shardInfo.put(shard, (long) hits.size());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/utils/BlurConstants.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurConstants.java b/blur-core/src/main/java/org/apache/blur/utils/BlurConstants.java
deleted file mode 100644
index 3f109b4..0000000
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurConstants.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.apache.blur.utils;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.blur.BlurConfiguration;
-import org.apache.blur.manager.results.BlurResultComparator;
-import org.apache.blur.manager.results.BlurResultPeekableIteratorComparator;
-import org.apache.blur.manager.results.PeekableIterator;
-import org.apache.blur.thrift.generated.BlurResult;
-import org.apache.lucene.index.Term;
-
-
-public class BlurConstants {
-
-  public static final String CONTROLLER = "controller";
-  public static final String SHARD = "shard";
-  public static final String SHARD_PREFIX = "shard-";
-  public static final Comparator<? super PeekableIterator<BlurResult>> HITS_PEEKABLE_ITERATOR_COMPARATOR
= new BlurResultPeekableIteratorComparator();
-  public static final Comparator<? super BlurResult> HITS_COMPARATOR = new BlurResultComparator();
-
-  public static final String PRIME_DOC = "_prime_";
-  public static final String PRIME_DOC_VALUE = "true";
-  public static final String ROW_ID = "rowid";
-  public static final String RECORD_ID = "recordid";
-  public static final String FAMILY = "family";
-  public static final String SUPER = "super";
-  public static final String SEP = ".";
-
-  public static final String BLUR_TABLE_PATH = "blur.table.path";
-  public static final String BLUR_ZOOKEEPER_CONNECTION = "blur.zookeeper.connection";
-  public static final String BLUR_SHARD_HOSTNAME = "blur.shard.hostname";
-  public static final String BLUR_SHARD_BIND_PORT = "blur.shard.bind.port";
-  public static final String BLUR_SHARD_BIND_ADDRESS = "blur.shard.bind.address";
-  public static final String BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION = "blur.shard.blockcache.direct.memory.allocation";
-  public static final String BLUR_SHARD_BLOCKCACHE_SLAB_COUNT = "blur.shard.blockcache.slab.count";
-  public static final String BLUR_SHARD_SAFEMODEDELAY = "blur.shard.safemodedelay";
-  public static final String BLUR_CONTROLLER_HOSTNAME = "blur.controller.hostname";
-  public static final String BLUR_CONTROLLER_BIND_PORT = "blur.controller.bind.port";
-  public static final String BLUR_CONTROLLER_BIND_ADDRESS = "blur.controller.bind.address";
-  public static final String BLUR_QUERY_MAX_ROW_FETCH = "blur.query.max.row.fetch";
-  public static final String BLUR_QUERY_MAX_RECORD_FETCH = "blur.query.max.record.fetch";
-  public static final String BLUR_QUERY_MAX_RESULTS_FETCH = "blur.query.max.results.fetch";
-
-  public static final String BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT = "blur.shard.server.thrift.thread.count";
-  public static final String BLUR_SHARD_CACHE_MAX_TIMETOLIVE = "blur.shard.cache.max.timetolive";
-  public static final String BLUR_SHARD_FILTER_CACHE_CLASS = "blur.shard.filter.cache.class";
-  public static final String BLUR_SHARD_INDEX_WARMUP_CLASS = "blur.shard.index.warmup.class";
-  public static final String BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT = "blur.indexmanager.search.thread.count";
-  public static final String BLUR_SHARD_DATA_FETCH_THREAD_COUNT = "blur.shard.data.fetch.thread.count";
-  public static final String BLUR_MAX_CLAUSE_COUNT = "blur.max.clause.count";
-  public static final String BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS = "blur.shard.cache.max.querycache.elements";
-  public static final String BLUR_SHARD_OPENER_THREAD_COUNT = "blur.shard.opener.thread.count";
-  public static final String BLUR_SHARD_INDEX_DELETION_POLICY_MAXAGE = "blur.shard.index.deletion.policy.maxage";
-  public static final String BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE = "blur.zookeeper.system.time.tolerance";
-  public static final String BLUR_SAHRD_INDEX_SIMILARITY = "blur.sahrd.index.similarity";
-
-  public static final String BLUR_SHARD_TIME_BETWEEN_COMMITS = "blur.shard.time.between.commits";
-  public static final String BLUR_SHARD_TIME_BETWEEN_REFRESHS = "blur.shard.time.between.refreshs";
-
-  public static final String BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT = "blur.controller.server.thrift.thread.count";
-  public static final String BLUR_CONTROLLER_SERVER_REMOTE_THREAD_COUNT = "blur.controller.server.remote.thread.count";
-  public static final String BLUR_CONTROLLER_CACHE_MAX_TIMETOLIVE = "blur.controller.cache.max.timetolive";
-  public static final String BLUR_CONTROLLER_CACHE_MAX_QUERYCACHE_ELEMENTS = "blur.controller.cache.max.querycache.elements";
-  public static final String BLUR_CONTROLLER_REMOTE_FETCH_COUNT = "blur.controller.remote.fetch.count";
-
-  public static final String BLUR_CONTROLLER_RETRY_MAX_MUTATE_RETRIES = "blur.controller.retry.max.mutate.retries";
-  public static final String BLUR_CONTROLLER_RETRY_MAX_DEFAULT_RETRIES = "blur.controller.retry.max.default.retries";
-  public static final String BLUR_CONTROLLER_RETRY_FETCH_DELAY = "blur.controller.retry.fetch.delay";
-  public static final String BLUR_CONTROLLER_RETRY_DEFAULT_DELAY = "blur.controller.retry.default.delay";
-  public static final String BLUR_CONTROLLER_RETRY_MUTATE_DELAY = "blur.controller.retry.mutate.delay";
-  public static final String BLUR_CONTROLLER_RETRY_MAX_FETCH_DELAY = "blur.controller.retry.max.fetch.delay";
-  public static final String BLUR_CONTROLLER_RETRY_MAX_MUTATE_DELAY = "blur.controller.retry.max.mutate.delay";
-  public static final String BLUR_CONTROLLER_RETRY_MAX_DEFAULT_DELAY = "blur.controller.retry.max.default.delay";
-  public static final String BLUR_CONTROLLER_RETRY_MAX_FETCH_RETRIES = "blur.controller.retry.max.fetch.retries";
-
-  public static final String BLUR_GUI_CONTROLLER_PORT = "blur.gui.controller.port";
-  public static final String BLUR_GUI_SHARD_PORT = "blur.gui.shard.port";
-
-  public static final String DEFAULT = "default";
-  public static final String BLUR_CLUSTER_NAME = "blur.cluster.name";
-  public static final String BLUR_CLUSTER;
-
-  public static final long ZK_WAIT_TIME = TimeUnit.SECONDS.toMillis(5);
-
-  public static final Term PRIME_DOC_TERM = new Term(PRIME_DOC, BlurConstants.PRIME_DOC_VALUE);
-
-  static {
-    try {
-      BlurConfiguration configuration = new BlurConfiguration();
-      BLUR_CLUSTER = configuration.get(BLUR_CLUSTER_NAME, DEFAULT);
-    } catch (IOException e) {
-      throw new RuntimeException("Unknown error parsing configuration.", e);
-    }
-  }
-
-  public static int getPid() {
-    return 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index 029ee6e..30efdce 100644
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -28,12 +28,14 @@ import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.lang.management.ManagementFactory;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -50,7 +52,10 @@ import java.util.regex.Pattern;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.clusterstatus.ZookeeperPathConstants;
+import org.apache.blur.manager.results.BlurResultComparator;
 import org.apache.blur.manager.results.BlurResultIterable;
+import org.apache.blur.manager.results.BlurResultPeekableIteratorComparator;
+import org.apache.blur.manager.results.PeekableIterator;
 import org.apache.blur.thirdparty.thrift_0_9_0.TBase;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TJSONProtocol;
@@ -78,13 +83,13 @@ import org.apache.lucene.index.AtomicReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.SlowCompositeReaderWrapper;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.util.RamUsageEstimator;
-import org.apache.lucene.search.BooleanClause;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.Code;
@@ -105,6 +110,10 @@ public class BlurUtil {
   private static final String UNKNOWN = "UNKNOWN";
   private static Pattern validator = Pattern.compile("^[a-zA-Z0-9\\_\\-]+$");
 
+  public static final Comparator<? super PeekableIterator<BlurResult>> HITS_PEEKABLE_ITERATOR_COMPARATOR
= new BlurResultPeekableIteratorComparator();
+  public static final Comparator<? super BlurResult> HITS_COMPARATOR = new BlurResultComparator();
+  public static final Term PRIME_DOC_TERM = new Term(BlurConstants.PRIME_DOC, BlurConstants.PRIME_DOC_VALUE);
+
   @SuppressWarnings("unchecked")
   public static <T extends Iface> T recordMethodCallsAndAverageTimes(final T t, Class<T>
clazz) {
     final Map<String, Histogram> histogramMap = new ConcurrentHashMap<String, Histogram>();
@@ -577,7 +586,7 @@ public class BlurUtil {
     recordMutation.setRecordMutationType(RecordMutationType.REPLACE_ENTIRE_RECORD);
     return recordMutation;
   }
-  
+
   public static int countDocuments(IndexReader reader, Term term) throws IOException {
     TermQuery query = new TermQuery(term);
     IndexSearcher indexSearcher = new IndexSearcher(reader);
@@ -596,24 +605,23 @@ public class BlurUtil {
   public static List<Document> fetchDocuments(IndexReader reader, Term term,
       ResetableDocumentStoredFieldVisitor fieldSelector, Selector selector) throws IOException
{
     IndexSearcher indexSearcher = new IndexSearcher(reader);
-		int docFreq = reader.docFreq(term);
-		BooleanQuery booleanQueryForFamily = null;
-		BooleanQuery booleanQuery = null;
-		if (selector.getColumnFamiliesToFetchSize() > 0) {
-			booleanQueryForFamily = new BooleanQuery();
-			for (String familyName : selector.getColumnFamiliesToFetch()) {
-				booleanQueryForFamily.add(new TermQuery(new Term(
-						BlurConstants.FAMILY, familyName)),
-						BooleanClause.Occur.SHOULD);
-			}
-			booleanQuery = new BooleanQuery();
-			booleanQuery.add(new TermQuery(term), BooleanClause.Occur.MUST);
-			booleanQuery.add(booleanQueryForFamily, BooleanClause.Occur.MUST);
-		}
-		Query query = booleanQuery == null ? new TermQuery(term) : booleanQuery;
-		TopDocs topDocs = indexSearcher.search(query, docFreq);
-		int totalHits = topDocs.totalHits;
-		List<Document> docs = new ArrayList<Document>();
+    int docFreq = reader.docFreq(term);
+    BooleanQuery booleanQueryForFamily = null;
+    BooleanQuery booleanQuery = null;
+    if (selector.getColumnFamiliesToFetchSize() > 0) {
+      booleanQueryForFamily = new BooleanQuery();
+      for (String familyName : selector.getColumnFamiliesToFetch()) {
+        booleanQueryForFamily
+            .add(new TermQuery(new Term(BlurConstants.FAMILY, familyName)), BooleanClause.Occur.SHOULD);
+      }
+      booleanQuery = new BooleanQuery();
+      booleanQuery.add(new TermQuery(term), BooleanClause.Occur.MUST);
+      booleanQuery.add(booleanQueryForFamily, BooleanClause.Occur.MUST);
+    }
+    Query query = booleanQuery == null ? new TermQuery(term) : booleanQuery;
+    TopDocs topDocs = indexSearcher.search(query, docFreq);
+    int totalHits = topDocs.totalHits;
+    List<Document> docs = new ArrayList<Document>();
 
     int start = selector.getStartRecord();
     int end = selector.getMaxRecordsToFetch() + start;
@@ -638,28 +646,36 @@ public class BlurUtil {
     int index = shard.indexOf('-');
     return Integer.parseInt(shard.substring(index + 1));
   }
-  
-	public static void validateRowIdAndRecord(String rowId, Record record) {
-		if (!validator.matcher(record.family).matches()) {
-			throw new IllegalArgumentException("Invalid column family name [ " + record.family + "
]. It should contain only this pattern [A-Za-z0-9_-]");
-		}
-
-		for (Column column : record.getColumns()) {
-			if (!validator.matcher(column.name).matches()) {
-				throw new IllegalArgumentException("Invalid column name [ " + column.name + " ]. It should
contain only this pattern [A-Za-z0-9_-]");
-			}
-		}
-	}
-
-	public static void validateTableName(String tableName) {
-		if (!validator.matcher(tableName).matches()) {
-			throw new IllegalArgumentException("Invalid table name [ " + tableName + " ]. It should
contain only this pattern [A-Za-z0-9_-]");
-		}
-	}
-
-	public static void validateShardName(String shardName) {
-		if (!validator.matcher(shardName).matches()) {
-			throw new IllegalArgumentException("Invalid shard name [ " + shardName + " ]. It should
contain only this pattern [A-Za-z0-9_-]");
-		}
-	}
+
+  public static void validateRowIdAndRecord(String rowId, Record record) {
+    if (!validator.matcher(record.family).matches()) {
+      throw new IllegalArgumentException("Invalid column family name [ " + record.family
+          + " ]. It should contain only this pattern [A-Za-z0-9_-]");
+    }
+
+    for (Column column : record.getColumns()) {
+      if (!validator.matcher(column.name).matches()) {
+        throw new IllegalArgumentException("Invalid column name [ " + column.name
+            + " ]. It should contain only this pattern [A-Za-z0-9_-]");
+      }
+    }
+  }
+
+  public static void validateTableName(String tableName) {
+    if (!validator.matcher(tableName).matches()) {
+      throw new IllegalArgumentException("Invalid table name [ " + tableName
+          + " ]. It should contain only this pattern [A-Za-z0-9_-]");
+    }
+  }
+
+  public static void validateShardName(String shardName) {
+    if (!validator.matcher(shardName).matches()) {
+      throw new IllegalArgumentException("Invalid shard name [ " + shardName
+          + " ]. It should contain only this pattern [A-Za-z0-9_-]");
+    }
+  }
+
+  public static String getPid() {
+    return ManagementFactory.getRuntimeMXBean().getName();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java b/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
deleted file mode 100644
index f10502d..0000000
--- a/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.blur.utils;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.ReaderClosedListener;
-import org.apache.lucene.search.Collector;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.util.OpenBitSet;
-
-
-public class PrimeDocCache {
-
-  private static final Log LOG = LogFactory.getLog(PrimeDocCache.class);
-
-  public static final OpenBitSet EMPTY_BIT_SET = new OpenBitSet();
-
-  private static Map<Object, OpenBitSet> primeDocMap = new ConcurrentHashMap<Object,
OpenBitSet>();
-
-  /**
-   * The way this method is called via warm up methods the likelihood of
-   * creating multiple bitsets during a race condition is very low, that's why
-   * this method is not synced.
-   */
-  public static OpenBitSet getPrimeDocBitSet(IndexReader reader) throws IOException {
-    Object key = reader.getCoreCacheKey();
-    OpenBitSet bitSet = primeDocMap.get(key);
-    if (bitSet == null) {
-      reader.addReaderClosedListener(new ReaderClosedListener() {
-        @Override
-        public void onClose(IndexReader reader) {
-          Object key = reader.getCoreCacheKey();
-          LOG.debug("Current size [" + primeDocMap.size() + "] Prime Doc BitSet removing
for segment [" + reader + "]");
-          primeDocMap.remove(key);
-        }
-      });
-      LOG.debug("Prime Doc BitSet missing for segment [" + reader + "] current size [" +
primeDocMap.size() + "]");
-      final OpenBitSet bs = new OpenBitSet(reader.maxDoc());
-      primeDocMap.put(key, bs);
-      IndexSearcher searcher = new IndexSearcher(reader);
-      searcher.search(new TermQuery(BlurConstants.PRIME_DOC_TERM), new Collector() {
-        
-        @Override
-        public void setScorer(Scorer scorer) throws IOException {
-          
-        }
-        
-        @Override
-        public void setNextReader(AtomicReaderContext atomicReaderContext) throws IOException
{
-        }
-        
-        @Override
-        public void collect(int doc) throws IOException {
-          bs.set(doc);
-        }
-        
-        @Override
-        public boolean acceptsDocsOutOfOrder() {
-          return false;
-        }
-      });
-      return bs;
-    }
-    return bitSet;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-core/src/test/java/org/apache/blur/manager/results/BlurResultPeekableIteratorComparatorTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/results/BlurResultPeekableIteratorComparatorTest.java
b/blur-core/src/test/java/org/apache/blur/manager/results/BlurResultPeekableIteratorComparatorTest.java
index 02107fd..659508c 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/results/BlurResultPeekableIteratorComparatorTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/results/BlurResultPeekableIteratorComparatorTest.java
@@ -22,9 +22,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.blur.manager.results.PeekableIterator;
 import org.apache.blur.thrift.generated.BlurResult;
-import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.utils.BlurUtil;
 import org.junit.Test;
 
 
@@ -41,7 +40,7 @@ public class BlurResultPeekableIteratorComparatorTest {
     results.add(new PeekableIterator<BlurResult>(new ArrayList<BlurResult>(Arrays.asList(newResult("9",
1))).iterator()));
     results.add(new PeekableIterator<BlurResult>(new ArrayList<BlurResult>().iterator()));
 
-    Collections.sort(results, BlurConstants.HITS_PEEKABLE_ITERATOR_COMPARATOR);
+    Collections.sort(results, BlurUtil.HITS_PEEKABLE_ITERATOR_COMPARATOR);
 
     for (PeekableIterator<BlurResult> iterator : results) {
       System.out.println(iterator.peek());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-query/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java b/blur-query/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
index d16d84c..89735aa 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
@@ -17,10 +17,10 @@ package org.apache.blur.analysis;
  * limitations under the License.
  */
 import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
-import static org.apache.blur.util.BlurConstants.PRIME_DOC;
-import static org.apache.blur.util.BlurConstants.RECORD_ID;
-import static org.apache.blur.util.BlurConstants.ROW_ID;
-import static org.apache.blur.util.BlurConstants.SUPER;
+import static org.apache.blur.utils.BlurConstants.PRIME_DOC;
+import static org.apache.blur.utils.BlurConstants.RECORD_ID;
+import static org.apache.blur.utils.BlurConstants.ROW_ID;
+import static org.apache.blur.utils.BlurConstants.SUPER;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-query/src/main/java/org/apache/blur/util/BlurConstants.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/util/BlurConstants.java b/blur-query/src/main/java/org/apache/blur/util/BlurConstants.java
deleted file mode 100644
index 6aaac17..0000000
--- a/blur-query/src/main/java/org/apache/blur/util/BlurConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.blur.util;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-public class BlurConstants {
-  public static final String PRIME_DOC = "_prime_";
-  public static final String PRIME_DOC_VALUE = "true";
-  public static final String ROW_ID = "rowid";
-  public static final String RECORD_ID = "recordid";
-  public static final String SUPER = "super";
-  public static final String FAMILY = "family";
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7a6a9807/blur-store/src/main/java/org/apache/blur/store/hdfs/BlurLockFactory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/hdfs/BlurLockFactory.java b/blur-store/src/main/java/org/apache/blur/store/hdfs/BlurLockFactory.java
index 9f3bf00..f119446 100644
--- a/blur-store/src/main/java/org/apache/blur/store/hdfs/BlurLockFactory.java
+++ b/blur-store/src/main/java/org/apache/blur/store/hdfs/BlurLockFactory.java
@@ -40,7 +40,7 @@ public class BlurLockFactory extends LockFactory {
   private byte[] _lockKey;
   private final Path _dir;
 
-  public BlurLockFactory(Configuration configuration, Path dir, String host, int pid) throws
IOException {
+  public BlurLockFactory(Configuration configuration, Path dir, String host, String pid)
throws IOException {
     _configuration = configuration;
     _dir = dir;
     _fileSystem = _dir.getFileSystem(_configuration);


Mime
View raw message