incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/2] git commit: Adding reverse feature for sorting.
Date Sat, 01 Feb 2014 01:24:08 GMT
Adding reverse feature for sorting.


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

Branch: refs/heads/apache-blur-0.2
Commit: ed2da2c0527fcea54267006f44f3663cbac1227b
Parents: b98ad9d
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Jan 31 20:17:24 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Jan 31 20:17:24 2014 -0500

----------------------------------------------------------------------
 .../org/apache/blur/manager/writer/BlurIndexSimpleWriter.java  | 3 +--
 .../org/apache/blur/analysis/type/DateFieldTypeDefinition.java | 3 +++
 .../apache/blur/analysis/type/DoubleFieldTypeDefinition.java   | 6 ++++--
 .../apache/blur/analysis/type/FloatFieldTypeDefinition.java    | 5 ++++-
 .../org/apache/blur/analysis/type/IntFieldTypeDefinition.java  | 3 +++
 .../org/apache/blur/analysis/type/LongFieldTypeDefinition.java | 3 +++
 .../apache/blur/analysis/type/StringFieldTypeDefinition.java   | 3 +++
 7 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
index 12476b0..8ea4332 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
@@ -72,8 +72,7 @@ public class BlurIndexSimpleWriter extends BlurIndex {
   private final Lock _writeLock = _lock.writeLock();
   private Thread _optimizeThread;
   private Thread _writerOpener;
-
-  private IndexDeletionPolicyReader _policy;
+  private final IndexDeletionPolicyReader _policy;
 
   public BlurIndexSimpleWriter(ShardContext shardContext, Directory directory, SharedMergeScheduler
mergeScheduler,
       DirectoryReferenceFileGC gc, final ExecutorService searchExecutor, BlurIndexCloser
indexCloser,

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/DateFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/DateFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/DateFieldTypeDefinition.java
index 45c06fb..5bb4bfb 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/DateFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/DateFieldTypeDefinition.java
@@ -122,6 +122,9 @@ public class DateFieldTypeDefinition extends NumericFieldTypeDefinition
{
 
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.LONG, reverse);
+    }
     return new SortField(getFieldName(), Type.LONG);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
index 1bdf050..1df8378 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
@@ -84,13 +84,15 @@ public class DoubleFieldTypeDefinition extends NumericFieldTypeDefinition
{
     double p2 = parseDouble(part2);
     return NumericRangeQuery.newDoubleRange(field, _precisionStep, p1, p2, startInclusive,
endInclusive);
   }
-  
 
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.DOUBLE, reverse);
+    }
     return new SortField(getFieldName(), Type.DOUBLE);
   }
-  
+
   private double parseDouble(String number) {
     if (number.toLowerCase().equals(MIN)) {
       return Double.MIN_VALUE;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
index 2b90231..b583810 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
@@ -84,9 +84,12 @@ public class FloatFieldTypeDefinition extends NumericFieldTypeDefinition
{
     float p2 = parseFloat(part2);
     return NumericRangeQuery.newFloatRange(field, _precisionStep, p1, p2, startInclusive,
endInclusive);
   }
-  
+
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.FLOAT, reverse);
+    }
     return new SortField(getFieldName(), Type.FLOAT);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
index e2751d2..f4bb0de 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
@@ -87,6 +87,9 @@ public class IntFieldTypeDefinition extends NumericFieldTypeDefinition {
 
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.INT, reverse);
+    }
     return new SortField(getFieldName(), Type.INT);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
index 45ed273..0a4faf6 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
@@ -87,6 +87,9 @@ public class LongFieldTypeDefinition extends NumericFieldTypeDefinition
{
 
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.LONG, reverse);
+    }
     return new SortField(getFieldName(), Type.LONG);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ed2da2c0/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
index 5a1405f..e938311 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
@@ -120,6 +120,9 @@ public class StringFieldTypeDefinition extends FieldTypeDefinition {
 
   @Override
   public SortField getSortField(boolean reverse) {
+    if (reverse) {
+      return new SortField(getFieldName(), Type.STRING, reverse);
+    }
     return new SortField(getFieldName(), Type.STRING);
   }
 }


Mime
View raw message