You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ko...@apache.org on 2010/06/27 02:46:41 UTC
svn commit: r958304 - in /lucene/dev/branches/branch_3x/solr: CHANGES.txt
src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java
Author: koji
Date: Sun Jun 27 00:46:41 2010
New Revision: 958304
URL: http://svn.apache.org/viewvc?rev=958304&view=rev
Log:
SOLR-1974: add LimitTokenCountFilterFactory
Added:
lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java
Modified:
lucene/dev/branches/branch_3x/solr/CHANGES.txt
Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=958304&r1=958303&r2=958304&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Sun Jun 27 00:46:41 2010
@@ -143,6 +143,7 @@ New Features
* SOLR-1923: PhoneticFilterFactory now has support for the
Caverphone algorithm. (rmuir)
+* SOLR-1974: Add LimitTokenCountFilterFactory. (koji)
Optimizations
----------------------
Added: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java?rev=958304&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java (added)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/analysis/LimitTokenCountFilterFactory.java Sun Jun 27 00:46:41 2010
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+package org.apache.solr.analysis;
+
+import java.util.Map;
+
+import org.apache.lucene.analysis.LimitTokenCountFilter;
+import org.apache.lucene.analysis.TokenStream;
+
+public class LimitTokenCountFilterFactory extends BaseTokenFilterFactory {
+
+ int maxTokenCount;
+
+ @Override
+ public void init(Map<String, String> args) {
+ super.init( args );
+ maxTokenCount = Integer.parseInt( args.get( "maxTokenCount" ) );
+ }
+
+ @Override
+ public TokenStream create(TokenStream input) {
+ return new LimitTokenCountFilter( input, maxTokenCount );
+ }
+
+}