Index: contrib/analyzers/src/test/org/apache/lucene/analysis/reverse/TestReverseStringFilter.java
===================================================================
--- contrib/analyzers/src/test/org/apache/lucene/analysis/reverse/TestReverseStringFilter.java	(revision 0)
+++ contrib/analyzers/src/test/org/apache/lucene/analysis/reverse/TestReverseStringFilter.java	(revision 0)
@@ -0,0 +1,52 @@
+/**
+ * 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.lucene.analysis.reverse;
+
+import java.io.StringReader;
+
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.WhitespaceTokenizer;
+import org.apache.lucene.util.LuceneTestCase;
+
+public class TestReverseStringFilter extends LuceneTestCase {
+  public void testFilter() throws Exception {
+    TokenStream stream = new WhitespaceTokenizer(
+        new StringReader("Do have a nice day"));     // 1-4 length string
+    ReverseStringFilter filter = new ReverseStringFilter(stream);
+    final Token reusableToken = new Token();
+    assertEquals("oD", filter.next(reusableToken).term());
+    assertEquals("evah", filter.next(reusableToken).term());
+    assertEquals("a", filter.next(reusableToken).term());
+    assertEquals("ecin", filter.next(reusableToken).term());
+    assertEquals("yad", filter.next(reusableToken).term());
+    assertNull(filter.next(reusableToken));
+  }
+
+  public void testReverseString() throws Exception {
+    assertEquals( "A", ReverseStringFilter.reverse( "A" ) );
+    assertEquals( "BA", ReverseStringFilter.reverse( "AB" ) );
+    assertEquals( "CBA", ReverseStringFilter.reverse( "ABC" ) );
+  }
+  
+  public void testReverseChar() throws Exception {
+    char[] buffer = { 'A', 'B', 'C', 'D', 'E', 'F' };
+    ReverseStringFilter.reverse( buffer, 2, 3 );
+    assertEquals( "ABEDCF", new String( buffer ) );
+  }
+}
Index: contrib/analyzers/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilter.java
===================================================================
--- contrib/analyzers/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilter.java	(revision 0)
+++ contrib/analyzers/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilter.java	(revision 0)
@@ -0,0 +1,69 @@
+/**
+ * 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.lucene.analysis.reverse;
+
+import org.apache.lucene.analysis.TokenFilter;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Token;
+
+import java.io.IOException;
+
+/**
+ * Reverse token string e.g. "country" => "yrtnuoc".
+ *
+ * @version $Id$
+ */
+public final class ReverseStringFilter extends TokenFilter {
+
+  public ReverseStringFilter(TokenStream in) {
+    super(in);
+  }
+
+  public final Token next(Token in) throws IOException {
+    assert in != null;
+    Token token=input.next(in);
+    if( token == null ) return null;
+    reverse( token.termBuffer(), token.termLength() );
+    return token;
+  }
+
+  public static String reverse( final String input ){
+    char[] charInput = input.toCharArray();
+    reverse( charInput );
+    return new String( charInput );
+  }
+  
+  public static void reverse( char[] buffer ){
+    reverse( buffer, buffer.length );
+  }
+  
+  public static void reverse( char[] buffer, int len ){
+    reverse( buffer, 0, len );
+  }
+  
+  public static void reverse( char[] buffer, int start, int len ){
+    if( len <= 1 ) return;
+    int num = len / 2;
+    char c;
+    for( int i = start; i < ( start + num ); i++ ){
+      c = buffer[i];
+      buffer[i] = buffer[start * 2 + len - i - 1];
+      buffer[start * 2 + len - i - 1] = c;
+    }
+  }
+}
