incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/8] git commit: Working on analyzer.
Date Tue, 16 Oct 2012 00:57:06 GMT
Updated Branches:
  refs/heads/lucene-4.0.0 [created] a5054c950


Working on analyzer.


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

Branch: refs/heads/lucene-4.0.0
Commit: a5054c9500399f65a33b9694acb1f4795dfeabcb
Parents: d636f62
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Oct 15 20:51:05 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Oct 15 20:51:05 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/analysis/BlurAnalyzer.java     |   47 +++-----------
 src/blur-store/pom.xml                             |   10 +++
 2 files changed, 20 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a5054c95/src/blur-core/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java b/src/blur-core/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
index e68d812..752c08d 100644
--- a/src/blur-core/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/analysis/BlurAnalyzer.java
@@ -16,7 +16,7 @@ package org.apache.blur.analysis;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import static org.apache.blur.lucene.LuceneConstant.LUCENE_VERSION;
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 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;
@@ -28,7 +28,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Reader;
 import java.lang.reflect.Constructor;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -45,12 +44,11 @@ import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.KeywordAnalyzer;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.AnalyzerWrapper;
+import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.NumericRangeQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.Version;
@@ -59,7 +57,7 @@ import org.apache.thrift.protocol.TJSONProtocol;
 import org.apache.thrift.transport.TMemoryBuffer;
 import org.apache.thrift.transport.TMemoryInputTransport;
 
-public final class BlurAnalyzer extends Analyzer {
+public final class BlurAnalyzer extends AnalyzerWrapper {
 
   public enum TYPE {
     LONG, DOUBLE, FLOAT, INTEGER, DEFAULT
@@ -228,42 +226,16 @@ public final class BlurAnalyzer extends Analyzer {
   public void close() {
 
   }
-
+  
   @Override
-  public TokenStream tokenStream(String fieldName, Reader reader) {
+  protected Analyzer getWrappedAnalyzer(String fieldName) {
     Analyzer analyzer = getAnalyzer(fieldName);
-    if (analyzer == null) {
-      analyzer = _defaultAnalyzer;
-    }
-
-    return analyzer.tokenStream(fieldName, reader);
+    return (analyzer != null) ? analyzer : _defaultAnalyzer;
   }
 
   @Override
-  public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException
{
-    Analyzer analyzer = getAnalyzer(fieldName);
-    if (analyzer == null)
-      analyzer = _defaultAnalyzer;
-
-    return analyzer.reusableTokenStream(fieldName, reader);
-  }
-
-  /** Return the positionIncrementGap from the analyzer assigned to fieldName */
-  @Override
-  public int getPositionIncrementGap(String fieldName) {
-    Analyzer analyzer = getAnalyzer(fieldName);
-    if (analyzer == null)
-      analyzer = _defaultAnalyzer;
-    return analyzer.getPositionIncrementGap(fieldName);
-  }
-
-  /** Return the offsetGap from the analyzer assigned to field */
-  @Override
-  public int getOffsetGap(Fieldable field) {
-    Analyzer analyzer = getAnalyzer(field.name());
-    if (analyzer == null)
-      analyzer = _defaultAnalyzer;
-    return analyzer.getOffsetGap(field);
+  protected TokenStreamComponents wrapComponents(String fieldName, TokenStreamComponents
components) {
+    return components;
   }
 
   public static BlurAnalyzer create(File file) throws IOException {
@@ -461,4 +433,5 @@ public final class BlurAnalyzer extends Analyzer {
     set.add(name);
   }
 
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a5054c95/src/blur-store/pom.xml
----------------------------------------------------------------------
diff --git a/src/blur-store/pom.xml b/src/blur-store/pom.xml
index 8b13cda..b9210d2 100644
--- a/src/blur-store/pom.xml
+++ b/src/blur-store/pom.xml
@@ -42,6 +42,16 @@ under the License.
 			<version>4.0.0</version>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.lucene</groupId>
+			<artifactId>lucene-analyzers-common</artifactId>
+			<version>4.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.lucene</groupId>
+			<artifactId>lucene-queryparser</artifactId>
+			<version>4.0.0</version>
+		</dependency>
+		<dependency>
 			<groupId>commons-cli</groupId>
 			<artifactId>commons-cli</artifactId>
 			<version>1.2</version>


Mime
View raw message