Index: lucene/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationDocValuesField.java
===================================================================
--- lucene/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationDocValuesField.java	(revision 0)
+++ lucene/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationDocValuesField.java	(working copy)
@@ -0,0 +1,75 @@
+package org.apache.lucene.collation;
+
+/**
+ * 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.
+ */
+
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.SortField;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.LuceneTestCase;
+
+import com.ibm.icu.text.Collator;
+import com.ibm.icu.util.ULocale;
+
+/**
+ * trivial test of ICUCollationDocValuesField
+ */
+public class TestICUCollationDocValuesField extends LuceneTestCase {
+  public void test() throws Exception {
+    assumeFalse("3.x codec does not support docvalues", Codec.getDefault().getName().equals("Lucene3x"));
+    Directory dir = newDirectory();
+    RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
+    Document doc = new Document();
+    Field field = newField("field", "", StringField.TYPE_STORED);
+    ICUCollationDocValuesField collationField = new ICUCollationDocValuesField("collated", 
+        Collator.getInstance(ULocale.ENGLISH));
+    doc.add(field);
+    doc.add(collationField);
+
+    field.setStringValue("ABC");
+    collationField.setValue("ABC");
+    iw.addDocument(doc);
+    
+    field.setStringValue("abc");
+    collationField.setValue("abc");
+    iw.addDocument(doc);
+    
+    IndexReader ir = iw.getReader();
+    iw.close();
+    
+    IndexSearcher is = newSearcher(ir);
+    
+    SortField sortField = new SortField("collated", SortField.Type.STRING);
+    sortField.setUseIndexValues(true);
+    
+    TopDocs td = is.search(new MatchAllDocsQuery(), 5, new Sort(sortField));
+    assertEquals("abc", ir.document(td.scoreDocs[0].doc).get("field"));
+    assertEquals("ABC", ir.document(td.scoreDocs[1].doc).get("field"));
+    ir.close();
+    dir.close();
+  }
+}

Property changes on: lucene/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationDocValuesField.java
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationDocValuesField.java
===================================================================
--- lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationDocValuesField.java	(revision 0)
+++ lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationDocValuesField.java	(working copy)
@@ -0,0 +1,106 @@
+package org.apache.lucene.collation;
+
+/**
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.IndexableFieldType;
+import org.apache.lucene.util.BytesRef;
+
+import com.ibm.icu.text.Collator;
+import com.ibm.icu.text.RawCollationKey;
+
+/**
+ * nocommit
+ */
+public final class ICUCollationDocValuesField implements IndexableField {
+  private static final FieldType ft;
+  
+  static {
+    ft = new FieldType();
+    ft.setDocValueType(DocValues.Type.BYTES_VAR_SORTED);
+    ft.freeze();
+  }
+  
+  private final String name;
+  private final Collator collator;
+  private final BytesRef bytes = new BytesRef();
+  private final RawCollationKey key = new RawCollationKey();
+  
+  public ICUCollationDocValuesField(String name, Collator collator) {
+    this.name = name;
+    try {
+      this.collator = (Collator) collator.clone();
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Override
+  public String name() {
+    return name;
+  }
+  
+  public void setValue(String value) {
+    collator.getRawCollationKey(value, key);
+    bytes.bytes = key.bytes;
+    bytes.offset = 0;
+    bytes.length = key.size;
+  }
+
+  @Override
+  public IndexableFieldType fieldType() {
+    return ft;
+  }
+
+  @Override
+  public float boost() {
+    return 1.0F;
+  }
+
+  @Override
+  public BytesRef binaryValue() {
+    return bytes;
+  }
+
+  @Override
+  public String stringValue() {
+    return null;
+  }
+
+  @Override
+  public Reader readerValue() {
+    return null;
+  }
+
+  @Override
+  public Number numericValue() {
+    return null;
+  }
+
+  @Override
+  public TokenStream tokenStream(Analyzer analyzer) throws IOException {
+    return null;
+  }
+}

Property changes on: lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationDocValuesField.java
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
