incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/3] git commit: BLUR-ID:31 fix compilation errors
Date Wed, 17 Oct 2012 00:47:51 GMT
BLUR-ID:31 fix compilation errors

Signed-off-by: Aaron McCurry <amccurry@gmail.com>


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

Branch: refs/heads/lucene-4.0.0
Commit: d3f74ae3bf41124ba4fe51fac2fa0b1ad9822a52
Parents: 93fd30b
Author: Gagan <gagandeepjuneja@gmail.com>
Authored: Tue Oct 16 22:32:00 2012 +0530
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 16 20:32:20 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/analysis/DoubleAnalyzer.java   |   31 ++++++++---
 .../org/apache/blur/analysis/FloatAnalyzer.java    |   42 ++++++++++----
 .../org/apache/blur/analysis/IntegerAnalyzer.java  |   42 ++++++++++----
 .../org/apache/blur/analysis/LongAnalyzer.java     |   42 ++++++++++----
 .../apache/blur/analysis/DoubleAnalyzerTest.java   |   17 +++---
 .../apache/blur/analysis/FloatAnalyzerTest.java    |   17 +++---
 .../apache/blur/analysis/IntegerAnalyzerTest.java  |   19 +++----
 .../org/apache/blur/analysis/LongAnalyzerTest.java |   14 +++---
 8 files changed, 145 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/main/java/org/apache/blur/analysis/DoubleAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/analysis/DoubleAnalyzer.java b/src/blur-core/src/main/java/org/apache/blur/analysis/DoubleAnalyzer.java
index 92b4ccb..01abeae 100644
--- a/src/blur-core/src/main/java/org/apache/blur/analysis/DoubleAnalyzer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/analysis/DoubleAnalyzer.java
@@ -18,11 +18,11 @@ package org.apache.blur.analysis;
  */
 import java.io.IOException;
 import java.io.Reader;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.NumericTokenStream;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.lucene.util.NumericUtils;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 public final class DoubleAnalyzer extends Analyzer {
 
@@ -44,18 +44,33 @@ public final class DoubleAnalyzer extends Analyzer {
   public void setPrecisionStep(int precisionStep) {
     this.precisionStep = precisionStep;
   }
-
   @Override
-  public TokenStream tokenStream(String fieldName, Reader reader) {
-    NumericTokenStream numericTokenStream = new NumericTokenStream(precisionStep);
+  protected TokenStreamComponents createComponents(String fieldName,
+      Reader reader) {
+    final CharTokenizer source = new CharTokenizer(LUCENE_VERSION, reader) {
+      @Override
+      protected boolean isTokenChar(int arg0) {
+        return true;
+      }
+    };
+
+    final double value;
     try {
-      numericTokenStream.setDoubleValue(toDouble(reader));
+      value = toDouble(reader);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
-    return numericTokenStream;
-  }
+    final NumericTokenStream numericTokenStream = new NumericTokenStream(
+        precisionStep);
+    numericTokenStream.setDoubleValue(value);
 
+    return new TokenStreamComponents(source, numericTokenStream) {
+      public void setReader(Reader reader) throws IOException {
+        numericTokenStream.reset();
+        numericTokenStream.setDoubleValue(toDouble(reader));
+      }
+    };
+  }
   private double toDouble(Reader reader) throws IOException {
     StringBuilder builder = new StringBuilder(20);
     int read;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/main/java/org/apache/blur/analysis/FloatAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/analysis/FloatAnalyzer.java b/src/blur-core/src/main/java/org/apache/blur/analysis/FloatAnalyzer.java
index b2be140..fb04888 100644
--- a/src/blur-core/src/main/java/org/apache/blur/analysis/FloatAnalyzer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/analysis/FloatAnalyzer.java
@@ -21,8 +21,9 @@ import java.io.Reader;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.NumericTokenStream;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.lucene.util.NumericUtils;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 public final class FloatAnalyzer extends Analyzer {
 
@@ -45,17 +46,6 @@ public final class FloatAnalyzer extends Analyzer {
     this.precisionStep = precisionStep;
   }
 
-  @Override
-  public TokenStream tokenStream(String fieldName, Reader reader) {
-    NumericTokenStream numericTokenStream = new NumericTokenStream(precisionStep);
-    try {
-      numericTokenStream.setFloatValue(toFloat(reader));
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return numericTokenStream;
-  }
-
   private float toFloat(Reader reader) throws IOException {
     StringBuilder builder = new StringBuilder(20);
     int read;
@@ -64,5 +54,33 @@ public final class FloatAnalyzer extends Analyzer {
     }
     return Float.parseFloat(builder.toString());
   }
+  
+  @Override
+  protected TokenStreamComponents createComponents(String fieldName,
+      Reader reader) {
+    final CharTokenizer source = new CharTokenizer(LUCENE_VERSION, reader) {
+      @Override
+      protected boolean isTokenChar(int arg0) {
+        return true;
+      }
+    };
+
+    final float value;
+    try {
+      value = toFloat(reader);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+    final NumericTokenStream numericTokenStream = new NumericTokenStream(
+        precisionStep);
+    numericTokenStream.setFloatValue(value);
+
+    return new TokenStreamComponents(source, numericTokenStream) {
+      public void setReader(Reader reader) throws IOException {
+        numericTokenStream.reset();
+        numericTokenStream.setFloatValue(toFloat(reader));
+      }
+    };
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/main/java/org/apache/blur/analysis/IntegerAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/analysis/IntegerAnalyzer.java b/src/blur-core/src/main/java/org/apache/blur/analysis/IntegerAnalyzer.java
index eb2c71d..f63330e 100644
--- a/src/blur-core/src/main/java/org/apache/blur/analysis/IntegerAnalyzer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/analysis/IntegerAnalyzer.java
@@ -21,8 +21,9 @@ import java.io.Reader;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.NumericTokenStream;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.lucene.util.NumericUtils;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 public final class IntegerAnalyzer extends Analyzer {
 
@@ -60,17 +61,6 @@ public final class IntegerAnalyzer extends Analyzer {
     this.precisionStep = precisionStep;
   }
 
-  @Override
-  public TokenStream tokenStream(String fieldName, Reader reader) {
-    NumericTokenStream numericTokenStream = new NumericTokenStream(precisionStep);
-    try {
-      numericTokenStream.setIntValue(toInteger(reader));
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return numericTokenStream;
-  }
-
   private int toInteger(Reader reader) throws IOException {
     StringBuilder builder = new StringBuilder(20);
     int read;
@@ -79,5 +69,33 @@ public final class IntegerAnalyzer extends Analyzer {
     }
     return Integer.parseInt(builder.toString(), radix);
   }
+  
+  @Override
+  protected TokenStreamComponents createComponents(String fieldName,
+      Reader reader) {
+    final CharTokenizer source = new CharTokenizer(LUCENE_VERSION, reader) {
+      @Override
+      protected boolean isTokenChar(int arg0) {
+        return true;
+      }
+    };
+
+    final int value;
+    try {
+      value = toInteger(reader);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+    final NumericTokenStream numericTokenStream = new NumericTokenStream(
+        precisionStep);
+    numericTokenStream.setIntValue(value);
+
+    return new TokenStreamComponents(source, numericTokenStream) {
+      public void setReader(Reader reader) throws IOException {
+        numericTokenStream.reset();
+        numericTokenStream.setIntValue(toInteger(reader));
+      }
+    };
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/main/java/org/apache/blur/analysis/LongAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/analysis/LongAnalyzer.java b/src/blur-core/src/main/java/org/apache/blur/analysis/LongAnalyzer.java
index f5b8f3d..b8d7a54 100644
--- a/src/blur-core/src/main/java/org/apache/blur/analysis/LongAnalyzer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/analysis/LongAnalyzer.java
@@ -21,8 +21,9 @@ import java.io.Reader;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.NumericTokenStream;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.util.CharTokenizer;
 import org.apache.lucene.util.NumericUtils;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 public final class LongAnalyzer extends Analyzer {
 
@@ -60,17 +61,6 @@ public final class LongAnalyzer extends Analyzer {
     this.precisionStep = precisionStep;
   }
 
-  @Override
-  public TokenStream tokenStream(String fieldName, Reader reader) {
-    NumericTokenStream numericTokenStream = new NumericTokenStream(precisionStep);
-    try {
-      numericTokenStream.setLongValue(toLong(reader));
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return numericTokenStream;
-  }
-
   private long toLong(Reader reader) throws IOException {
     StringBuilder builder = new StringBuilder(20);
     int read;
@@ -79,5 +69,33 @@ public final class LongAnalyzer extends Analyzer {
     }
     return Long.parseLong(builder.toString(), radix);
   }
+  
+  @Override
+  protected TokenStreamComponents createComponents(String fieldName,
+      Reader reader) {
+    final CharTokenizer source = new CharTokenizer(LUCENE_VERSION, reader) {
+      @Override
+      protected boolean isTokenChar(int arg0) {
+        return true;
+      }
+    };
+
+    final long value;
+    try {
+      value = toLong(reader);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+    final NumericTokenStream numericTokenStream = new NumericTokenStream(
+        precisionStep);
+    numericTokenStream.setLongValue(value);
+
+    return new TokenStreamComponents(source, numericTokenStream) {
+      public void setReader(Reader reader) throws IOException {
+        numericTokenStream.reset();
+        numericTokenStream.setLongValue(toLong(reader));
+      }
+    };
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/test/java/org/apache/blur/analysis/DoubleAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/DoubleAnalyzerTest.java
b/src/blur-core/src/test/java/org/apache/blur/analysis/DoubleAnalyzerTest.java
index 7573025..1dd4e9d 100644
--- a/src/blur-core/src/test/java/org/apache/blur/analysis/DoubleAnalyzerTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/DoubleAnalyzerTest.java
@@ -30,10 +30,9 @@ import org.apache.blur.thrift.generated.ColumnDefinition;
 import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.NumericRangeQuery;
@@ -42,13 +41,13 @@ import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 import org.junit.Test;
 
 public class DoubleAnalyzerTest {
 
   @Test
-  public void testLongAnalyzer() throws IOException {
+  public void testDoubleAnalyzer() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("double", false, null));
@@ -59,7 +58,7 @@ public class DoubleAnalyzerTest {
   }
 
   @Test
-  public void testLongAnalyzerDifferentStep() throws IOException {
+  public void testDoubleAnalyzerDifferentStep() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("double,4", false, null));
@@ -70,18 +69,18 @@ public class DoubleAnalyzerTest {
   }
 
   private void runTestString(Analyzer analyzer) throws IOException {
-    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, analyzer);
+    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
     Directory dir = new RAMDirectory();
     IndexWriter indexWriter = new IndexWriter(dir, conf);
     for (int i = 0; i < 1000; i++) {
       Document document = new Document();
       String value = Double.toString(i);
-      document.add(new Field("test.test", value, Store.YES, Index.ANALYZED_NO_NORMS));
+      document.add(new TextField("test.test", value, Store.YES));
       indexWriter.addDocument(document);
     }
     indexWriter.close();
 
-    IndexSearcher searcher = new IndexSearcher(IndexReader.open(dir));
+    IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(dir));
     NumericRangeQuery<Double> query = NumericRangeQuery.newDoubleRange("test.test",
0.0, 2.0, true, true);
     Query rewrite = searcher.rewrite(query);
     TopDocs docs = searcher.search(rewrite, 100);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/test/java/org/apache/blur/analysis/FloatAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/FloatAnalyzerTest.java b/src/blur-core/src/test/java/org/apache/blur/analysis/FloatAnalyzerTest.java
index f989c90..4b57cb2 100644
--- a/src/blur-core/src/test/java/org/apache/blur/analysis/FloatAnalyzerTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/FloatAnalyzerTest.java
@@ -30,10 +30,9 @@ import org.apache.blur.thrift.generated.ColumnDefinition;
 import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.NumericRangeQuery;
@@ -42,13 +41,13 @@ import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 import org.junit.Test;
 
 public class FloatAnalyzerTest {
 
   @Test
-  public void testLongAnalyzer() throws IOException {
+  public void testFloatAnalyzer() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("float", false, null));
@@ -59,7 +58,7 @@ public class FloatAnalyzerTest {
   }
 
   @Test
-  public void testLongAnalyzerDifferentStep() throws IOException {
+  public void testFloatAnalyzerDifferentStep() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("float,4", false, null));
@@ -70,18 +69,18 @@ public class FloatAnalyzerTest {
   }
 
   private void runTestString(Analyzer analyzer) throws IOException {
-    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, analyzer);
+    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
     Directory dir = new RAMDirectory();
     IndexWriter indexWriter = new IndexWriter(dir, conf);
     for (int i = 0; i < 1000; i++) {
       Document document = new Document();
       String value = Float.toString(i);
-      document.add(new Field("test.test", value, Store.YES, Index.ANALYZED_NO_NORMS));
+      document.add(new TextField("test.test", value, Store.YES));
       indexWriter.addDocument(document);
     }
     indexWriter.close();
 
-    IndexSearcher searcher = new IndexSearcher(IndexReader.open(dir));
+    IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(dir));
     NumericRangeQuery<Float> query = NumericRangeQuery.newFloatRange("test.test", 0.0F,
2.0F, true, true);
     Query rewrite = searcher.rewrite(query);
     TopDocs docs = searcher.search(rewrite, 100);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/test/java/org/apache/blur/analysis/IntegerAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/IntegerAnalyzerTest.java
b/src/blur-core/src/test/java/org/apache/blur/analysis/IntegerAnalyzerTest.java
index 6c28e6c..c189ec1 100644
--- a/src/blur-core/src/test/java/org/apache/blur/analysis/IntegerAnalyzerTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/IntegerAnalyzerTest.java
@@ -30,10 +30,9 @@ import org.apache.blur.thrift.generated.ColumnDefinition;
 import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.NumericRangeQuery;
@@ -42,13 +41,13 @@ import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 import org.junit.Test;
 
 public class IntegerAnalyzerTest {
 
   @Test
-  public void testLongAnalyzer() throws IOException {
+  public void testIntegerAnalyzer() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("integer", false, null));
@@ -59,7 +58,7 @@ public class IntegerAnalyzerTest {
   }
 
   @Test
-  public void testLongAnalyzerDifferentStep() throws IOException {
+  public void testIntegerAnalyzerDifferentStep() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("integer,4", false, null));
@@ -70,7 +69,7 @@ public class IntegerAnalyzerTest {
   }
 
   @Test
-  public void testLongAnalyzerDifferentStepAndRadix() throws IOException {
+  public void testIntegerAnalyzerDifferentStepAndRadix() throws IOException {
     AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
     Map<String, ColumnDefinition> columnDefinitions = new HashMap<String, ColumnDefinition>();
     columnDefinitions.put("test", new ColumnDefinition("integer,4,16", false, null));
@@ -81,18 +80,18 @@ public class IntegerAnalyzerTest {
   }
 
   private void runTestString(Analyzer analyzer, int radix) throws IOException {
-    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, analyzer);
+    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
     Directory dir = new RAMDirectory();
     IndexWriter indexWriter = new IndexWriter(dir, conf);
     for (int i = 0; i < 1000; i++) {
       Document document = new Document();
       String value = Integer.toString(i, radix);
-      document.add(new Field("test.test", value, Store.YES, Index.ANALYZED_NO_NORMS));
+      document.add(new TextField("test.test", value, Store.YES));
       indexWriter.addDocument(document);
     }
     indexWriter.close();
 
-    IndexSearcher searcher = new IndexSearcher(IndexReader.open(dir));
+    IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(dir));
     NumericRangeQuery<Integer> query = NumericRangeQuery.newIntRange("test.test", 0,
2, true, true);
     Query rewrite = searcher.rewrite(query);
     TopDocs docs = searcher.search(rewrite, 100);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d3f74ae3/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java b/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
index c315933..a55ef1e 100644
--- a/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
@@ -30,10 +30,9 @@ import org.apache.blur.thrift.generated.ColumnDefinition;
 import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.NumericRangeQuery;
@@ -42,7 +41,8 @@ import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
+
 import org.junit.Test;
 
 public class LongAnalyzerTest {
@@ -82,18 +82,18 @@ public class LongAnalyzerTest {
   }
 
   private void runTestString(Analyzer analyzer, int radix) throws IOException {
-    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, analyzer);
+    IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, analyzer);
     Directory dir = new RAMDirectory();
     IndexWriter indexWriter = new IndexWriter(dir, conf);
     for (int i = 0; i < 1000; i++) {
       Document document = new Document();
       String value = Long.toString(i, radix);
-      document.add(new Field("test.test", value, Store.YES, Index.ANALYZED_NO_NORMS));
+      document.add(new TextField("test.test", value, Store.YES));
       indexWriter.addDocument(document);
     }
     indexWriter.close();
 
-    IndexSearcher searcher = new IndexSearcher(IndexReader.open(dir));
+    IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(dir));
     NumericRangeQuery<Long> query = NumericRangeQuery.newLongRange("test.test", 0L,
2L, true, true);
     Query rewrite = searcher.rewrite(query);
     TopDocs docs = searcher.search(rewrite, 100);


Mime
View raw message