incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [03/10] git commit: Adding javadoc.
Date Mon, 03 Jun 2013 02:02:18 GMT
Adding javadoc.


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

Branch: refs/heads/0.1.5
Commit: a58881f19892e912e1ae3158d8a0c47b6b34bd07
Parents: edf6c8e
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Jun 2 18:09:34 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Jun 2 18:09:34 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/manager/BlurFilterCache.java   |   52 ++++++++++++++-
 .../org/apache/blur/manager/BlurPartitioner.java   |    6 +-
 .../org/apache/blur/manager/BlurQueryChecker.java  |   43 ++++++++++---
 .../blur/manager/DefaultBlurFilterCache.java       |    3 +
 4 files changed, 92 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a58881f1/src/blur-core/src/main/java/org/apache/blur/manager/BlurFilterCache.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/BlurFilterCache.java b/src/blur-core/src/main/java/org/apache/blur/manager/BlurFilterCache.java
index 83f39ab..b200e6f 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/BlurFilterCache.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/BlurFilterCache.java
@@ -16,20 +16,70 @@ package org.apache.blur.manager;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import org.apache.blur.lucene.search.SuperParser;
 import org.apache.blur.manager.writer.BlurIndex;
+import org.apache.blur.thrift.generated.Record;
+import org.apache.blur.thrift.generated.Row;
 import org.apache.lucene.search.Filter;
 
-
+/**
+ * The {@link BlurFilterCache} class provides the ability to cache pre and post
+ * filters on a per table basis. The closing and opening methods should be used
+ * as hooks to for when tables are being enabled and disabled.
+ */
 public abstract class BlurFilterCache {
 
+  /**
+   * The fetchPreFilter method fetches the cache pre-filter (or {@link Record}
+   * Filter) before attempting to execute the filter provided by the user.
+   * 
+   * @param table
+   *          the table name.
+   * @param filterStr
+   *          the filter query string, should be used as a key.
+   * @return the {@link Filter} to execute or not is missing.
+   */
   public abstract Filter fetchPreFilter(String table, String filterStr);
 
+  /**
+   * The fetchPostFilter method fetches the cache post-filter (or {@link Row}
+   * Filter) before attempting to execute the filter provided by the user.
+   * 
+   * @param table
+   *          the table name.
+   * @param filterStr
+   *          the filter query string, should be used as a key.
+   * @return the {@link Filter} to execute or not is missing.
+   */
   public abstract Filter fetchPostFilter(String table, String filterStr);
 
+  /**
+   * The storePreFilter method stores the parsed pre {@link Filter} (or
+   * {@link Record} Filter) for caching, and should return the {@link Filter} to
+   * be executed.
+   * 
+   * @param table
+   *          the table name.
+   * @param filterStr
+   *          the filter query string, should be used as a key.
+   * @return the {@link Filter} that was parsed by the {@link SuperParser}.
+   */
   public abstract Filter storePreFilter(String table, String filterStr, Filter filter);
 
+  /**
+   * The storePreFilter method stores the parsed post {@link Filter} (or
+   * {@link Row} Filter) for caching, and should return the {@link Filter} to
+   * be executed.
+   * 
+   * @param table
+   *          the table name.
+   * @param filterStr
+   *          the filter query string, should be used as a key.
+   * @return the {@link Filter} that was parsed by the {@link SuperParser}.
+   */
   public abstract Filter storePostFilter(String table, String filterStr, Filter filter);
 
+
   public abstract void closing(String table, String shard, BlurIndex index);
 
   public abstract void opening(String table, String shard, BlurIndex index);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a58881f1/src/blur-core/src/main/java/org/apache/blur/manager/BlurPartitioner.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/BlurPartitioner.java b/src/blur-core/src/main/java/org/apache/blur/manager/BlurPartitioner.java
index 899cd17..404fe53 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/BlurPartitioner.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/BlurPartitioner.java
@@ -21,8 +21,10 @@ import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapreduce.Partitioner;
 
 /**
- * Simple hashing class used to guide the rows to the correct shards during
- * MapReduce jobs as well as during normal runtime operations.
+ * The {@link BlurPartitioner} class is a Hadoop {@link Partitioner}
+ * implementation for Blur. Simple hashing class used to guide the rows to the
+ * correct shards during MapReduce jobs as well as during normal runtime
+ * operations.
  */
 public class BlurPartitioner extends Partitioner<Text, Writable> {
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a58881f1/src/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java b/src/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
index 2676d21..dbf0477 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/BlurQueryChecker.java
@@ -16,15 +16,21 @@ package org.apache.blur.manager;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.apache.blur.utils.BlurConstants.BLUR_QUERY_MAX_RECORD_FETCH;
+import static org.apache.blur.utils.BlurConstants.BLUR_QUERY_MAX_RESULTS_FETCH;
+import static org.apache.blur.utils.BlurConstants.BLUR_QUERY_MAX_ROW_FETCH;
+
 import org.apache.blur.BlurConfiguration;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.BlurQuery;
+import org.apache.blur.thrift.generated.Selector;
+import org.apache.blur.util.BlurConstants;
 
-
-import static org.apache.blur.utils.BlurConstants.*;
-
+/**
+ * The {@link BlurQueryChecker} class check the {@link BlurQuery} for valid
+ * settings before allowing the query to be executed.
+ */
 public class BlurQueryChecker {
 
   private static final Log LOG = LogFactory.getLog(BlurQueryChecker.class);
@@ -33,32 +39,51 @@ public class BlurQueryChecker {
   private int _maxQueryRecordFetch;
   private int _maxQueryResultsFetch;
 
+  /**
+   * Reads the {@link BlurConstants} BLUR_QUERY_MAX_RESULTS_FETCH,
+   * BLUR_QUERY_MAX_ROW_FETCH, and BLUR_QUERY_MAX_RECORD_FETCH to validate the
+   * {@link BlurQuery} before execution.
+   * 
+   * @param configuration
+   */
   public BlurQueryChecker(BlurConfiguration configuration) {
     _maxQueryResultsFetch = configuration.getInt(BLUR_QUERY_MAX_RESULTS_FETCH, 100);
     _maxQueryRowFetch = configuration.getInt(BLUR_QUERY_MAX_ROW_FETCH, 100);
     _maxQueryRecordFetch = configuration.getInt(BLUR_QUERY_MAX_RECORD_FETCH, 100);
   }
 
-  public void checkQuery(BlurQuery blurQuery) throws BlurException {
+  /**
+   * Checks the query by running validation against the {@link BlurQuery} and
+   * the {@link Selector} provided.
+   * 
+   * @param blurQuery
+   *          the {@link BlurQuery} to validate.
+   */
+  public void checkQuery(BlurQuery blurQuery) {
     if (blurQuery.selector != null) {
       if (blurQuery.selector.recordOnly) {
         if (blurQuery.fetch > _maxQueryRecordFetch) {
-          LOG.warn("Number of records requested to be fetched [{0}] is greater than the max
allowed [{1}]", _maxQueryRecordFetch);
+          LOG.warn("Number of records requested to be fetched [{0}] is greater than the max
allowed [{1}]",
+              _maxQueryRecordFetch);
           blurQuery.fetch = (int) blurQuery.minimumNumberOfResults;
         }
       } else {
         if (blurQuery.fetch > _maxQueryRowFetch) {
-          LOG.warn("Number of rows requested to be fetched [{0}] is greater than the max
allowed [{1}]", _maxQueryRowFetch);
+          LOG.warn("Number of rows requested to be fetched [{0}] is greater than the max
allowed [{1}]",
+              _maxQueryRowFetch);
           blurQuery.fetch = (int) blurQuery.minimumNumberOfResults;
         }
       }
     }
     if (blurQuery.fetch > _maxQueryResultsFetch) {
-      LOG.warn("Number of results requested to be fetched [{0}] is greater than the max allowed
[{1}]", _maxQueryResultsFetch);
+      LOG.warn("Number of results requested to be fetched [{0}] is greater than the max allowed
[{1}]",
+          _maxQueryResultsFetch);
       blurQuery.fetch = (int) blurQuery.minimumNumberOfResults;
     }
     if (blurQuery.fetch > blurQuery.minimumNumberOfResults) {
-      LOG.warn("Number of rows/records requested to be fetched [{0}] is greater than the
minimum number of results [{1}]", blurQuery.fetch, blurQuery.minimumNumberOfResults);
+      LOG.warn(
+          "Number of rows/records requested to be fetched [{0}] is greater than the minimum
number of results [{1}]",
+          blurQuery.fetch, blurQuery.minimumNumberOfResults);
       blurQuery.fetch = (int) blurQuery.minimumNumberOfResults;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a58881f1/src/blur-core/src/main/java/org/apache/blur/manager/DefaultBlurFilterCache.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/DefaultBlurFilterCache.java
b/src/blur-core/src/main/java/org/apache/blur/manager/DefaultBlurFilterCache.java
index ef46895..b0a6122 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/DefaultBlurFilterCache.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/DefaultBlurFilterCache.java
@@ -20,6 +20,9 @@ import org.apache.blur.manager.writer.BlurIndex;
 import org.apache.lucene.search.Filter;
 
 
+/**
+ * This implementation on {@link BlurFilterCache} does nothing and it is the default {@link
BlurFilterCache}.
+ */
 public class DefaultBlurFilterCache extends BlurFilterCache {
 
   @Override


Mime
View raw message