lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r900166 [1/2] - in /lucene/java/branches/flex_1458: contrib/misc/src/java/org/apache/lucene/index/ contrib/misc/src/java/org/apache/lucene/misc/ contrib/queries/src/java/org/apache/lucene/search/ contrib/regex/src/java/org/apache/lucene/sea...
Date Sun, 17 Jan 2010 17:44:12 GMT
Author: mikemccand
Date: Sun Jan 17 17:44:08 2010
New Revision: 900166

URL: http://svn.apache.org/viewvc?rev=900166&view=rev
Log:
LUCENE-2111 (flex branch) cutover to BytesRef for terms

Added:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java   (with props)
Removed:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermRef.java
Modified:
    lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java
    lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
    lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/DuplicateFilter.java
    lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
    lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermsEnum.java
    lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java
    lucene/java/branches/flex_1458/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
    lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java
    lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTermQuery.java
    lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ByteBlockPool.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxFieldMergeState.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxTermsWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyFieldsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyTerms.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentMergeInfo.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/Terms.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsHashPerField.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/Codec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/FieldsConsumer.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/TermsConsumer.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/IntBlockCodec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingCodec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepCodec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsIndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsIndexWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/AutomatonTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/EmptyTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/FieldCache.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/FieldCacheImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/FilteredTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/FuzzyQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiPhraseQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/PhraseQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/PrefixTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/SingleTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermRangeTermsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/spans/SpanTermQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/NumericUtils.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCodecs.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestFlexExternalReader.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/JustCompileSearch.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestSort.java

Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java Sun Jan 17 17:44:08 2010
@@ -17,12 +17,11 @@
 
 import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Collection;
-import java.util.Iterator;
 
 
 /**
@@ -108,7 +107,7 @@
     if (terms != null) {
       TermsEnum termsEnum = terms.iterator();
       while(true) {
-        TermRef text = termsEnum.next();
+        BytesRef text = termsEnum.next();
         if (text != null) {
           anyTerms = true;
           DocsEnum docs = termsEnum.docs(delDocs);

Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java Sun Jan 17 17:44:08 2010
@@ -18,10 +18,9 @@
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.FieldsEnum;
-import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.PriorityQueue;
@@ -60,7 +59,7 @@
       if (terms != null) {
         TermsEnum termsEnum = terms.iterator();
         while(true) {
-          TermRef term = termsEnum.next();
+          BytesRef term = termsEnum.next();
           if (term != null) {
             tiq.insertWithOverflow(new TermInfo(new Term(field, term.toString()), termsEnum.docFreq()));
           } else {
@@ -75,7 +74,7 @@
         if (field != null) {
           TermsEnum terms = fields.terms();
           while(true) {
-            TermRef term = terms.next();
+            BytesRef term = terms.next();
             if (term != null) {
               tiq.insertWithOverflow(new TermInfo(new Term(field, term.toString()), terms.docFreq()));
             } else {

Modified: lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/DuplicateFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/DuplicateFilter.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/DuplicateFilter.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/DuplicateFilter.java Sun Jan 17 17:44:08 2010
@@ -16,11 +16,9 @@
  * limitations under the License.
  */
 import java.io.IOException;
-import java.util.BitSet;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.DocsEnum;
 import org.apache.lucene.index.TermsEnum;
@@ -90,7 +88,7 @@
     if (terms != null) {
       TermsEnum termsEnum = terms.iterator();
       while(true) {
-        TermRef currTerm = termsEnum.next();
+        BytesRef currTerm = termsEnum.next();
         if (currTerm == null) {
           break;
         } else {
@@ -127,7 +125,7 @@
     if (terms != null) {
       TermsEnum termsEnum = terms.iterator();
       while(true) {
-        TermRef currTerm = termsEnum.next();
+        BytesRef currTerm = termsEnum.next();
         if (currTerm == null) {
           break;
         } else {

Modified: lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java Sun Jan 17 17:44:08 2010
@@ -29,7 +29,7 @@
 import org.apache.lucene.analysis.tokenattributes.TermAttribute;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.PriorityQueue;
 
 /**
@@ -204,7 +204,7 @@
                   int df = reader.docFreq(startTerm);
                   int numVariants=0;
                   int totalVariantDocFreqs=0;
-                  TermRef possibleMatch;
+                  BytesRef possibleMatch;
                   MultiTermQuery.BoostAttribute boostAtt =
                     fe.attributes().addAttribute(MultiTermQuery.BoostAttribute.class);
                   while ((possibleMatch = fe.next()) != null) {

Modified: lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermsEnum.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermsEnum.java (original)
+++ lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermsEnum.java Sun Jan 17 17:44:08 2010
@@ -20,8 +20,7 @@
 import org.apache.lucene.search.FilteredTermsEnum;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 
@@ -38,7 +37,7 @@
 public class RegexTermsEnum extends FilteredTermsEnum {
   private String pre = "";
   private RegexCapabilities regexImpl;
-  private final TermRef prefixRef;
+  private final BytesRef prefixRef;
 
   public RegexTermsEnum(IndexReader reader, Term term, RegexCapabilities regexImpl) throws IOException {
     super(reader, term.field());
@@ -50,12 +49,12 @@
     pre = regexImpl.prefix();
     if (pre == null) pre = "";
 
-    prefixRef = new TermRef(pre);
+    prefixRef = new BytesRef(pre);
     setInitialSeekTerm(prefixRef);
   }
 
   @Override
-  protected final AcceptStatus accept(TermRef term) {
+  protected final AcceptStatus accept(BytesRef term) {
     if (term.startsWith(prefixRef)) {
       return regexImpl.match(term.toString()) ? AcceptStatus.YES : AcceptStatus.NO;
     } else {

Modified: lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java (original)
+++ lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java Sun Jan 17 17:44:08 2010
@@ -36,7 +36,7 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
@@ -219,7 +219,7 @@
     @Override
     public void setNextReader(IndexReader reader, int docBase) throws IOException {
       docValues = FieldCache.DEFAULT.getInts(reader, "parser", new FieldCache.IntParser() {
-          public final int parseInt(TermRef termRef) {
+          public final int parseInt(BytesRef termRef) {
             return (termRef.toString().charAt(0)-'A') * 123456;
           }
         });

Modified: lucene/java/branches/flex_1458/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java (original)
+++ lucene/java/branches/flex_1458/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java Sun Jan 17 17:44:08 2010
@@ -22,9 +22,8 @@
 import java.util.Iterator;
 
 import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.Term;
 import org.apache.lucene.util.StringHelper;
 
 import java.io.*;
@@ -55,8 +54,7 @@
 
   final class LuceneIterator implements Iterator {
     private TermsEnum termsEnum;
-    private TermRef pendingTerm;
-    private boolean hasNextCalled;
+    private BytesRef pendingTerm;
 
     LuceneIterator() {
       try {

Modified: lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndPrefixQuery.java Sun Jan 17 17:44:08 2010
@@ -18,7 +18,7 @@
 
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.IndexReader;
 
@@ -26,11 +26,11 @@
 
 
 public class SrndPrefixQuery extends SimpleTerm {
-  private final TermRef prefixRef;
+  private final BytesRef prefixRef;
   public SrndPrefixQuery(String prefix, boolean quoted, char truncator) {
     super(quoted);
     this.prefix = prefix;
-    prefixRef = new TermRef(prefix);
+    prefixRef = new BytesRef(prefix);
     this.truncator = truncator;
   }
 
@@ -63,7 +63,7 @@
       TermsEnum termsEnum = terms.iterator();
 
       boolean skip = false;
-      TermsEnum.SeekStatus status = termsEnum.seek(new TermRef(getPrefix()));
+      TermsEnum.SeekStatus status = termsEnum.seek(new BytesRef(getPrefix()));
       if (status == TermsEnum.SeekStatus.FOUND) {
         mtv.visitMatchingTerm(getLucenePrefixTerm(fieldName));
         expanded = true;
@@ -81,7 +81,7 @@
 
       if (!skip) {
         while(true) {
-          TermRef text = termsEnum.next();
+          BytesRef text = termsEnum.next();
           if (text != null && text.startsWith(prefixRef)) {
             mtv.visitMatchingTerm(new Term(fieldName, text.toString()));
             expanded = true;

Modified: lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTermQuery.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTermQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTermQuery.java Sun Jan 17 17:44:08 2010
@@ -22,7 +22,7 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 
  
 public class SrndTermQuery extends SimpleTerm {
@@ -52,7 +52,7 @@
     if (terms != null) {
       TermsEnum termsEnum = terms.iterator();
 
-      TermsEnum.SeekStatus status = termsEnum.seek(new TermRef(getTermText()));
+      TermsEnum.SeekStatus status = termsEnum.seek(new BytesRef(getTermText()));
       if (status == TermsEnum.SeekStatus.FOUND) {
         mtv.visitMatchingTerm(getLuceneTerm(fieldName));
       } else {

Modified: lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SrndTruncQuery.java Sun Jan 17 17:44:08 2010
@@ -19,7 +19,7 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.IndexReader;
 
 import java.io.IOException;
@@ -42,7 +42,7 @@
   private final char mask;
   
   private String prefix;
-  private TermRef prefixRef;
+  private BytesRef prefixRef;
   private Pattern pattern;
   
   
@@ -71,7 +71,7 @@
       i++;
     }
     prefix = truncated.substring(0, i);
-    prefixRef = new TermRef(prefix);
+    prefixRef = new BytesRef(prefix);
     
     StringBuilder re = new StringBuilder();
     while (i < truncated.length()) {
@@ -96,7 +96,7 @@
         TermsEnum termsEnum = terms.iterator();
 
         TermsEnum.SeekStatus status = termsEnum.seek(prefixRef);
-        TermRef text;
+        BytesRef text;
         if (status == TermsEnum.SeekStatus.FOUND) {
           text = prefixRef;
         } else if (status == TermsEnum.SeekStatus.NOT_FOUND) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ByteBlockPool.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ByteBlockPool.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ByteBlockPool.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ByteBlockPool.java Sun Jan 17 17:44:08 2010
@@ -34,6 +34,7 @@
  * hit a non-zero byte. */
 
 import java.util.Arrays;
+import org.apache.lucene.util.BytesRef;
 
 final class ByteBlockPool {
 
@@ -144,9 +145,9 @@
     return newUpto+3;
   }
 
-  // Fill in a TermRef from terms length & bytes encoded in
+  // Fill in a BytesRef from term's length & bytes encoded in
   // byte block
-  final TermRef setTermRef(TermRef term, int textStart) {
+  final BytesRef setBytesRef(BytesRef term, int textStart) {
     final byte[] bytes = term.bytes = buffers[textStart >> DocumentsWriter.BYTE_BLOCK_SHIFT];
     int pos = textStart & DocumentsWriter.BYTE_BLOCK_MASK;
     if ((bytes[pos] & 0x80) == 0) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java Sun Jan 17 17:44:08 2010
@@ -24,6 +24,7 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.codecs.Codecs;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 import java.text.NumberFormat;
 import java.io.PrintStream;
@@ -599,7 +600,7 @@
         final TermsEnum terms = fields.terms();
         while(true) {
 
-          final TermRef term = terms.next();
+          final BytesRef term = terms.next();
           if (term == null) {
             break;
           }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java Sun Jan 17 17:44:08 2010
@@ -39,6 +39,7 @@
 import org.apache.lucene.util.PriorityQueue;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ReaderUtil;
+import org.apache.lucene.util.BytesRef;
 
 import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache entry on close
 
@@ -792,7 +793,7 @@
   }
 
   @Override
-  public int docFreq(String field, TermRef term) throws IOException {
+  public int docFreq(String field, BytesRef term) throws IOException {
     ensureOpen();
     int total = 0;          // sum freqs in segments
     for (int i = 0; i < subReaders.length; i++) {
@@ -1214,10 +1215,10 @@
     final TermsEnum terms;
     final int base;
     final int length;
-    TermRef current;
+    BytesRef current;
     final Bits skipDocs;
 
-    public TermsEnumWithBase(FieldsEnumWithBase start, TermsEnum terms, TermRef term) {
+    public TermsEnumWithBase(FieldsEnumWithBase start, TermsEnum terms, BytesRef term) {
       this.terms = terms;
       current = term;
       skipDocs = start.skipDocs;
@@ -1226,7 +1227,7 @@
       assert length >= 0: "length=" + length;
     }
 
-    public TermsEnumWithBase(TermsWithBase start, TermsEnum terms, TermRef term) {
+    public TermsEnumWithBase(TermsWithBase start, TermsEnum terms, BytesRef term) {
       this.terms = terms;
       current = term;
       skipDocs = start.skipDocs;
@@ -1253,7 +1254,7 @@
   }
 
   private final static class TermMergeQueue extends PriorityQueue<TermsEnumWithBase> {
-    TermRef.Comparator termComp;
+    BytesRef.Comparator termComp;
     TermMergeQueue(int size) {
       initialize(size);
     }
@@ -1316,21 +1317,21 @@
   // sub-segments.
   private final static class MultiTerms extends Terms {
     private final TermsWithBase[] subs;
-    private final TermRef.Comparator termComp;
+    private final BytesRef.Comparator termComp;
 
     public MultiTerms(TermsWithBase[] subs) throws IOException {
       this.subs = subs;
       
-      TermRef.Comparator _termComp = null;
+      BytesRef.Comparator _termComp = null;
       for(int i=0;i<subs.length;i++) {
         if (_termComp == null) {
-          _termComp = subs[i].terms.getTermComparator();
+          _termComp = subs[i].terms.getComparator();
         } else {
           // We cannot merge sub-readers that have
           // different TermComps
-          final TermRef.Comparator subTermComp = subs[i].terms.getTermComparator();
+          final BytesRef.Comparator subTermComp = subs[i].terms.getComparator();
           if (subTermComp != null && !subTermComp.equals(_termComp)) {
-            throw new IllegalStateException("sub-readers have different TermRef.Comparators; cannot merge");
+            throw new IllegalStateException("sub-readers have different BytesRef.Comparators; cannot merge");
           }
         }
       }
@@ -1343,7 +1344,7 @@
     }
 
     @Override
-    public TermRef.Comparator getTermComparator() {
+    public BytesRef.Comparator getComparator() {
       return termComp;
     }
   }
@@ -1431,9 +1432,9 @@
     private final TermsEnumWithBase[] top;
     int numTop;
     int numSubs;
-    private TermRef current;
+    private BytesRef current;
     private final MultiDocsEnum docs;
-    private TermRef.Comparator termComp;
+    private BytesRef.Comparator termComp;
 
     MultiTermsEnum(int size) {
       queue = new TermMergeQueue(size);
@@ -1443,12 +1444,12 @@
     }
 
     @Override
-    public TermRef term() {
+    public BytesRef term() {
       return current;
     }
 
     @Override
-    public TermRef.Comparator getTermComparator() {
+    public BytesRef.Comparator getComparator() {
       return termComp;
     }
 
@@ -1462,16 +1463,16 @@
         final TermsEnum termsEnum = terms[i].terms.iterator();
         if (termsEnum != null) {
           if (termComp == null) {
-            queue.termComp = termComp = termsEnum.getTermComparator();
+            queue.termComp = termComp = termsEnum.getComparator();
           } else {
             // We cannot merge sub-readers that have
             // different TermComps
-            final TermRef.Comparator subTermComp = termsEnum.getTermComparator();
+            final BytesRef.Comparator subTermComp = termsEnum.getComparator();
             if (subTermComp != null && !subTermComp.equals(termComp)) {
-              throw new IllegalStateException("sub-readers have different TermRef.Comparators; cannot merge");
+              throw new IllegalStateException("sub-readers have different BytesRef.Comparators; cannot merge");
             }
           }
-          final TermRef term = termsEnum.next();
+          final BytesRef term = termsEnum.next();
           if (term != null) {
             subs[numSubs] = new TermsEnumWithBase(terms[i], termsEnum, term);
             queue.add(subs[numSubs]);
@@ -1494,12 +1495,12 @@
       for(int i=0;i<numFields;i++) {
         final TermsEnum terms = fields[i].fields.terms();
         if (terms != null) {
-          final TermRef term = terms.next();
+          final BytesRef term = terms.next();
           if (term != null) {
             if (termComp == null) {
-              queue.termComp = termComp = terms.getTermComparator();
+              queue.termComp = termComp = terms.getComparator();
             } else {
-              assert termComp.equals(terms.getTermComparator());
+              assert termComp.equals(terms.getComparator());
             }
             subs[numSubs] = new TermsEnumWithBase(fields[i], terms, term);
             queue.add(subs[numSubs]);
@@ -1514,7 +1515,7 @@
     }
 
     @Override
-    public SeekStatus seek(TermRef term) throws IOException {
+    public SeekStatus seek(BytesRef term) throws IOException {
       queue.clear();
       numTop = 0;
       for(int i=0;i<numSubs;i++) {
@@ -1558,7 +1559,7 @@
       assert numTop == 0;
       while(true) {
         top[numTop++] = queue.pop();
-        if (queue.size() == 0 || !(queue.top()).current.termEquals(top[0].current)) {
+        if (queue.size() == 0 || !(queue.top()).current.bytesEquals(top[0].current)) {
           break;
         }
       } 
@@ -1579,7 +1580,7 @@
     }
 
     @Override
-    public TermRef next() throws IOException {
+    public BytesRef next() throws IOException {
       // restore queue
       pushTop();
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java Sun Jan 17 17:44:08 2010
@@ -45,8 +45,11 @@
   // (defined?) after this?
   // nocommit -- fix this API so that intblock codecs are
   // able to return their own int arrays, to save a copy
-  /** Bulk read: returns number of docs read.  Subclass may
-   * do this more efficiently. */
+  /** Bulk read: returns number of docs read.
+   * 
+   *  <p>NOTE: the default impl simply delegates to {@link
+   *  #nextDoc}, but subclasses may do this more
+   *  efficiently. */
   public int read(int[] docs, int[] freqs) throws IOException {
     int count = 0;
     while(count < docs.length) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java Sun Jan 17 17:44:08 2010
@@ -41,6 +41,7 @@
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.ThreadInterruptedException;
+import org.apache.lucene.util.BytesRef;
 
 /**
  * This class accepts multiple added documents and directly
@@ -1001,7 +1002,7 @@
       TermsEnum termsEnum = null;
 
       String currentField = null;
-      TermRef termRef = new TermRef();
+      BytesRef termRef = new BytesRef();
       for (Entry<Term, BufferedDeletes.Num> entry: deletesFlushed.terms.entrySet()) {
         Term term = entry.getKey();
         // Since we visit terms sorted, we gain performance

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java Sun Jan 17 17:44:08 2010
@@ -22,6 +22,7 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache entry on close
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -224,7 +225,7 @@
   }
 
   @Override
-  public int docFreq(String field, TermRef t) throws IOException {
+  public int docFreq(String field, BytesRef t) throws IOException {
     ensureOpen();
     return in.docFreq(field, t);
   }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxFieldMergeState.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxFieldMergeState.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxFieldMergeState.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxFieldMergeState.java Sun Jan 17 17:44:08 2010
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import org.apache.lucene.util.BytesRef;
 
 // TODO FI: some of this is "generic" to TermsHash* so we
 // should factor it out so other consumers don't have to
@@ -33,7 +34,7 @@
   final RawPostingList[] postings;
 
   private FreqProxTermsWriter.PostingList p;
-  final TermRef text = new TermRef();
+  final BytesRef text = new BytesRef();
 
   private int postingUpto = -1;
 
@@ -43,7 +44,7 @@
   int docID;
   int termFreq;
 
-  public FreqProxFieldMergeState(FreqProxTermsWriterPerField field, TermRef.Comparator termComp) {
+  public FreqProxFieldMergeState(FreqProxTermsWriterPerField field, BytesRef.Comparator termComp) {
     this.field = field;
     this.numPostings = field.termsHashPerField.numPostings;
     this.postings = field.termsHashPerField.sortPostings(termComp);
@@ -59,8 +60,8 @@
     p = (FreqProxTermsWriter.PostingList) postings[postingUpto];
     docID = 0;
 
-    // Get TermRef
-    bytePool.setTermRef(text, p.textStart);
+    // Get BytesRef
+    bytePool.setBytesRef(text, p.textStart);
 
     field.termsHashPerField.initReader(freq, p, 0);
     if (!field.fieldInfo.omitTermFreqAndPositions) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxTermsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxTermsWriter.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxTermsWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FreqProxTermsWriter.java Sun Jan 17 17:44:08 2010
@@ -30,6 +30,7 @@
 import org.apache.lucene.index.codecs.PositionsConsumer;
 import org.apache.lucene.index.codecs.TermsConsumer;
 import org.apache.lucene.util.UnicodeUtil;
+import org.apache.lucene.util.BytesRef;
 
 final class FreqProxTermsWriter extends TermsHashConsumer {
 
@@ -154,12 +155,12 @@
 
     int numFields = fields.length;
 
-    final TermRef text = new TermRef();
+    final BytesRef text = new BytesRef();
 
     final FreqProxFieldMergeState[] mergeStates = new FreqProxFieldMergeState[numFields];
 
     final TermsConsumer termsConsumer = consumer.addField(fields[0].fieldInfo);
-    final TermRef.Comparator termComp = termsConsumer.getTermComparator();
+    final BytesRef.Comparator termComp = termsConsumer.getComparator();
 
     for(int i=0;i<numFields;i++) {
       FreqProxFieldMergeState fms = mergeStates[i] = new FreqProxFieldMergeState(fields[i], termComp);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java Sun Jan 17 17:44:08 2010
@@ -24,6 +24,7 @@
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.store.*;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -899,7 +900,7 @@
 
   /** Returns the number of documents containing the term <code>t</code>.
    * @throws IOException if there is a low-level IO error
-   * @deprecated Use {@link #docFreq(String,TermRef)} instead.
+   * @deprecated Use {@link #docFreq(String,BytesRef)} instead.
    */
   @Deprecated
   public abstract int docFreq(Term t) throws IOException;
@@ -908,7 +909,7 @@
    * <code>t</code>.  This method does not take into
    * account deleted documents that have not yet been
    * merged away. */
-  public int docFreq(String field, TermRef term) throws IOException {
+  public int docFreq(String field, BytesRef term) throws IOException {
     final Terms terms = fields().terms(field);
     if (terms != null) {
       return terms.docFreq(term);
@@ -970,7 +971,7 @@
   // nocommit -- tap into per-thread cache, here?
   // nocommit -- should we return null or NullDocsEnum?
   /** Returns DocsEnum for the specified field & term. */
-  public DocsEnum termDocsEnum(Bits skipDocs, String field, TermRef term) throws IOException {
+  public DocsEnum termDocsEnum(Bits skipDocs, String field, BytesRef term) throws IOException {
 
     assert field != null;
     assert term != null;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyFieldsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyFieldsEnum.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyFieldsEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyFieldsEnum.java Sun Jan 17 17:44:08 2010
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 /** Implements flex API (FieldsEnum/TermsEnum) on top of
  *  pre-flex API.  Used only for IndexReader impls outside
@@ -72,8 +73,8 @@
     private final IndexReader r;
     private final String field;
     private TermEnum terms;
-    private TermRef current;
-    private final TermRef tr = new TermRef();
+    private BytesRef current;
+    private final BytesRef tr = new BytesRef();
     private final LegacyDocsEnum docsEnum;
 
     LegacyTermsEnum(IndexReader r, String field) throws IOException {
@@ -83,13 +84,13 @@
     }
 
     @Override
-    public TermRef.Comparator getTermComparator() {
+    public BytesRef.Comparator getComparator() {
       // Pre-flex indexes always sorted in UTF16 order
-      return TermRef.getUTF8SortedAsUTF16Comparator();
+      return BytesRef.getUTF8SortedAsUTF16Comparator();
     }
 
     @Override
-    public SeekStatus seek(TermRef text) throws IOException {
+    public SeekStatus seek(BytesRef text) throws IOException {
       if (terms != null) {
         terms.close();
       }
@@ -102,7 +103,7 @@
       } else if (t.field() == field) {
         tr.copy(t.text());
         current = tr;
-        if (text.termEquals(tr)) {
+        if (text.bytesEquals(tr)) {
           return SeekStatus.FOUND;
         } else {
           return SeekStatus.NOT_FOUND;
@@ -123,7 +124,7 @@
     }
 
     @Override
-    public TermRef next() throws IOException {
+    public BytesRef next() throws IOException {
       if (terms == null) {
         // first next -- seek to start of field
         terms = r.terms(new Term(field, ""));
@@ -146,7 +147,7 @@
     }
 
     @Override
-    public TermRef term() {
+    public BytesRef term() {
       return current;
     }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyTerms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyTerms.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyTerms.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/LegacyTerms.java Sun Jan 17 17:44:08 2010
@@ -20,6 +20,7 @@
 import java.io.IOException;
 
 import org.apache.lucene.util.StringHelper;
+import org.apache.lucene.util.BytesRef;
 
 /** Implements flex API (FieldsEnum/TermsEnum) on top of
  *  pre-flex API.  Used only for IndexReader impls outside
@@ -40,9 +41,9 @@
   }
 
   @Override
-  public TermRef.Comparator getTermComparator() {
+  public BytesRef.Comparator getComparator() {
     // Pre-flex indexes always sorted in UTF16 order
-    return TermRef.getUTF8SortedAsUTF16Comparator();
+    return BytesRef.getUTF8SortedAsUTF16Comparator();
   }
 }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReader.java Sun Jan 17 17:44:08 2010
@@ -33,6 +33,7 @@
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache entry on close
+import org.apache.lucene.util.BytesRef;
 
 /** An IndexReader which reads multiple indexes, appending
  * their content. */
@@ -405,7 +406,7 @@
   }
   
   @Override
-  public int docFreq(String field, TermRef t) throws IOException {
+  public int docFreq(String field, BytesRef t) throws IOException {
     ensureOpen();
     int total = 0;          // sum freqs in segments
     for (int i = 0; i < subReaders.length; i++) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java Sun Jan 17 17:44:08 2010
@@ -23,6 +23,7 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache entry on close
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 import java.util.*;
@@ -471,7 +472,7 @@
   }
 
   @Override
-  public int docFreq(String field, TermRef term) throws IOException {
+  public int docFreq(String field, BytesRef term) throws IOException {
     ensureOpen();
     IndexReader reader = ((IndexReader)fieldToReader.get(field));
     return reader == null? 0 : reader.docFreq(field, term);
@@ -575,6 +576,7 @@
     return fieldSet;
   }
 
+  @Deprecated
   private class ParallelTermEnum extends TermEnum {
     private String field;
     private Iterator<String> fieldIterator;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentMergeInfo.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentMergeInfo.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentMergeInfo.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentMergeInfo.java Sun Jan 17 17:44:08 2010
@@ -20,6 +20,7 @@
 import java.io.IOException;
 
 import org.apache.lucene.index.codecs.Codec;
+import org.apache.lucene.util.BytesRef;
 
 final class SegmentMergeInfo {
   int base;
@@ -27,7 +28,7 @@
   final FieldsEnum fields;
   TermsEnum terms;
   String field;
-  TermRef term;
+  BytesRef term;
 
   IndexReader reader;
   int delCount;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java Sun Jan 17 17:44:08 2010
@@ -47,6 +47,7 @@
 import org.apache.lucene.index.codecs.preflex.SegmentTermPositions;
 import org.apache.lucene.index.codecs.FieldsProducer;
 import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache entry on close
+import org.apache.lucene.util.BytesRef;
 
 /** @version $Id */
 /**
@@ -936,14 +937,14 @@
     ensureOpen();
     Terms terms = core.fields.terms(t.field);
     if (terms != null) {
-      return terms.docFreq(new TermRef(t.text));
+      return terms.docFreq(new BytesRef(t.text));
     } else {
       return 0;
     }
   }
 
   @Override
-  public int docFreq(String field, TermRef term) throws IOException {
+  public int docFreq(String field, BytesRef term) throws IOException {
     ensureOpen();
 
     Terms terms = core.fields.terms(field);
@@ -1342,12 +1343,13 @@
   }
   
   // Back compat: pre-flex TermEnum API over flex API
+  @Deprecated
   final private class LegacyTermEnum extends TermEnum {
     FieldsEnum fields;
     TermsEnum terms;
     boolean done;
     String currentField;
-    TermRef currentTerm;
+    BytesRef currentTerm;
 
     public LegacyTermEnum(Term t) throws IOException {
       fields = core.fields.iterator();
@@ -1385,7 +1387,7 @@
             // and it would return the next Term.
             // if someone does this, tack on the lowest possible trail surrogate.
             // this emulates the old behavior, and forms "valid UTF-8" unicode.
-            TermRef tr = new TermRef(UnicodeUtil.nextValidUTF16String(text));
+            BytesRef tr = new BytesRef(UnicodeUtil.nextValidUTF16String(text));
             TermsEnum.SeekStatus status = terms.seek(tr);
 
             if (status == TermsEnum.SeekStatus.END) {
@@ -1526,7 +1528,7 @@
         }
       }
 
-      if (terms.seek(new TermRef(term.text)) == TermsEnum.SeekStatus.FOUND) {
+      if (terms.seek(new BytesRef(term.text)) == TermsEnum.SeekStatus.FOUND) {
         // Term exists
         docs = terms.docs(deletedDocs);
         if (Codec.DEBUG) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java Sun Jan 17 17:44:08 2010
@@ -22,6 +22,7 @@
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.util.BytesRef;
 
 final class TermVectorsTermsWriterPerField extends TermsHashConsumerPerField {
 
@@ -95,7 +96,7 @@
   public void abort() {}
 
   // nocommit -- should be @ thread level not field
-  private final TermRef flushTerm = new TermRef();
+  private final BytesRef flushTerm = new BytesRef();
 
   /** Called once per field per document if term vectors
    *  are enabled, to write the vectors to
@@ -129,7 +130,7 @@
 
     // nocommit -- should I sort by whatever terms dict is
     // sorting by?
-    final RawPostingList[] postings = termsHashPerField.sortPostings(TermRef.getUTF8SortedAsUTF16Comparator());
+    final RawPostingList[] postings = termsHashPerField.sortPostings(BytesRef.getUTF8SortedAsUTF16Comparator());
 
     tvf.writeVInt(numPostings);
     byte bits = 0x0;
@@ -150,8 +151,8 @@
       final TermVectorsTermsWriter.PostingList posting = (TermVectorsTermsWriter.PostingList) postings[j];
       final int freq = posting.freq;
 
-      // Get TermRef
-      termBytePool.setTermRef(flushTerm, posting.textStart);
+      // Get BytesRef
+      termBytePool.setBytesRef(flushTerm, posting.textStart);
 
       // Compute common byte prefix between last term and
       // this term

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/Terms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/Terms.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/Terms.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/Terms.java Sun Jan 17 17:44:08 2010
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 /**
  * NOTE: this API is experimental and will likely change
@@ -29,15 +30,15 @@
   /** Returns an iterator that will step through all terms */
   public abstract TermsEnum iterator() throws IOException;
   
-  /** Return the TermRef Comparator used to sort terms
+  /** Return the BytesRef Comparator used to sort terms
    *  provided by the iterator.  NOTE: this may return null
    *  if there are no terms.  This method may be invoked
    *  many times; it's best to cache a single instance &
    *  reuse it. */
-  public abstract TermRef.Comparator getTermComparator() throws IOException;
+  public abstract BytesRef.Comparator getComparator() throws IOException;
 
   /** Returns the docFreq of the specified term text. */
-  public int docFreq(TermRef text) throws IOException {
+  public int docFreq(BytesRef text) throws IOException {
     // nocommit -- make thread private cache so we share
     // single enum
     // NOTE: subclasses may have more efficient impl
@@ -50,7 +51,7 @@
   }
 
   /** Get DocsEnum for the specified term. */
-  public DocsEnum docs(Bits skipDocs, TermRef text) throws IOException {
+  public DocsEnum docs(Bits skipDocs, BytesRef text) throws IOException {
     // NOTE: subclasses may have more efficient impl
     final TermsEnum terms = iterator();
     if (terms.seek(text) == TermsEnum.SeekStatus.FOUND) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsEnum.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsEnum.java Sun Jan 17 17:44:08 2010
@@ -21,6 +21,7 @@
 
 import org.apache.lucene.util.AttributeSource;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 /**
  * NOTE: this API is experimental and will likely change
@@ -60,23 +61,23 @@
    *  indicate whether exact term was found, a different
    *  term was found, or EOF was hit.  The target term may
    *  be befor or after the current term. */
-  public abstract SeekStatus seek(TermRef text) throws IOException;
+  public abstract SeekStatus seek(BytesRef text) throws IOException;
 
   /** Seeks to the specified term by ordinal (position) as
    *  previously returned by {@link #ord}.  The target ord
    *  may be befor or after the current ord.  See {@link
-   *  #seek(TermRef). */
+   *  #seek(BytesRef). */
   public abstract SeekStatus seek(long ord) throws IOException;
   
   /** Increments the enumeration to the next element.
-   *  Returns the resulting TermRef, or null if the end was
-   *  hit.  The returned TermRef may be re-used across calls
+   *  Returns the resulting term, or null if the end was
+   *  hit.  The returned BytesRef may be re-used across calls
    *  to next. */
-  public abstract TermRef next() throws IOException;
+  public abstract BytesRef next() throws IOException;
 
   /** Returns current term.  This is undefined after next()
    *  returns null or seek returns {@link SeekStatus#END}. */
-  public abstract TermRef term() throws IOException;
+  public abstract BytesRef term() throws IOException;
 
   /** Returns ordinal position for current term.  Not all
    *  codecs implement this, so be prepared to catch an
@@ -98,10 +99,10 @@
    *  are done using the DocsEnum. */
   public abstract DocsEnum docs(Bits skipDocs) throws IOException;
 
-  /** Return the {@link TermRef} Comparator used to sort
+  /** Return the {@link BytesRef} Comparator used to sort
    *  terms provided by the iterator.  NOTE: this may return
    *  null if there are no terms.  Callers may invoke this
    *  method many times, so it's best to cache a single
    *  instance & reuse it. */
-  public abstract TermRef.Comparator getTermComparator() throws IOException;
+  public abstract BytesRef.Comparator getComparator() throws IOException;
 }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsHashPerField.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsHashPerField.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsHashPerField.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermsHashPerField.java Sun Jan 17 17:44:08 2010
@@ -23,6 +23,7 @@
 import org.apache.lucene.analysis.tokenattributes.TermAttribute;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.util.UnicodeUtil;
+import org.apache.lucene.util.BytesRef;
 
 final class TermsHashPerField extends InvertedDocConsumerPerField {
 
@@ -51,12 +52,12 @@
   private RawPostingList[] postingsHash = new RawPostingList[postingsHashSize];
   private RawPostingList p;
   private final UnicodeUtil.UTF8Result utf8;
-  private TermRef.Comparator termComp;
+  private BytesRef.Comparator termComp;
 
   // nocommit -- move to thread level
   // Used when comparing postings via termRefComp
-  private final TermRef tr1 = new TermRef();
-  private final TermRef tr2 = new TermRef();
+  private final BytesRef tr1 = new BytesRef();
+  private final BytesRef tr2 = new BytesRef();
 
   public TermsHashPerField(DocInverterPerField docInverterPerField, final TermsHashPerThread perThread, final TermsHashPerThread nextPerThread, final FieldInfo fieldInfo) {
     this.perThread = perThread;
@@ -145,7 +146,7 @@
   }
 
   /** Collapse the hash table & sort in-place. */
-  public RawPostingList[] sortPostings(TermRef.Comparator termComp) {
+  public RawPostingList[] sortPostings(BytesRef.Comparator termComp) {
     this.termComp = termComp;
     compactPostings();
     quickSort(postingsHash, 0, numPostings-1);
@@ -222,8 +223,8 @@
       return 0;
     }
 
-    termBytePool.setTermRef(tr1, p1.textStart);
-    termBytePool.setTermRef(tr2, p2.textStart);
+    termBytePool.setBytesRef(tr1, p1.textStart);
+    termBytePool.setBytesRef(tr2, p2.textStart);
 
     return termComp.compare(tr1, tr2);
   }
@@ -564,7 +565,7 @@
             len = (text[start]&0x7f) + ((text[start+1]&0xff)<<7);
             pos = start+2;
           }
-          //System.out.println("    term=" + bytePool.setTermRef(new TermRef(), p0.textStart).toBytesString());
+          //System.out.println("    term=" + bytePool.setBytesRef(new BytesRef(), p0.textStart).toBytesString());
 
           final int endPos = pos+len;
           while(pos < endPos) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/Codec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/Codec.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/Codec.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/Codec.java Sun Jan 17 17:44:08 2010
@@ -85,7 +85,6 @@
 
     // So we can easily compute headerSize (below)
     if (out.getFilePointer()-start != codec.length() + 9) {
-      System.out.println(out.getFilePointer()-start + " vs " + (codec.length() + 8));
       throw new IllegalArgumentException("codec must be simple ASCII, less than 128 characters in length [got " + codec + "]");
     }
   }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/FieldsConsumer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/FieldsConsumer.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/FieldsConsumer.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/FieldsConsumer.java Sun Jan 17 17:44:08 2010
@@ -21,7 +21,6 @@
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.FieldsEnum;
 import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.util.PriorityQueue;
 
 import java.io.IOException;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/TermsConsumer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/TermsConsumer.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/TermsConsumer.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/TermsConsumer.java Sun Jan 17 17:44:08 2010
@@ -19,10 +19,10 @@
 
 import java.io.IOException;
 
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.DocsEnum;
 import org.apache.lucene.util.PriorityQueue;
+import org.apache.lucene.util.BytesRef;
 
 /**
  * NOTE: this API is experimental and will likely change
@@ -31,30 +31,30 @@
 public abstract class TermsConsumer {
 
   /** Starts a new term in this field. */
-  public abstract DocsConsumer startTerm(TermRef text) throws IOException;
+  public abstract DocsConsumer startTerm(BytesRef text) throws IOException;
 
   /** Finishes the current term */
-  public abstract void finishTerm(TermRef text, int numDocs) throws IOException;
+  public abstract void finishTerm(BytesRef text, int numDocs) throws IOException;
 
   /** Called when we are done adding terms to this field */
   public abstract void finish() throws IOException;
 
-  /** Return the TermRef Comparator used to sort terms
+  /** Return the BytesRef Comparator used to sort terms
    *  before feeding to this API. */
-  public abstract TermRef.Comparator getTermComparator() throws IOException;
+  public abstract BytesRef.Comparator getComparator() throws IOException;
 
   // For default merge impl
   public static class TermMergeState {
-    TermRef current;
+    BytesRef current;
     TermsEnum termsEnum;
     int readerIndex;
   }
 
   private final static class MergeQueue extends PriorityQueue<TermMergeState> {
 
-    final TermRef.Comparator termComp;
+    final BytesRef.Comparator termComp;
 
-    public MergeQueue(int size, TermRef.Comparator termComp) {
+    public MergeQueue(int size, BytesRef.Comparator termComp) {
       initialize(size);
       this.termComp = termComp;
     }
@@ -77,7 +77,7 @@
   /** Default merge impl */
   public void merge(MergeState mergeState, TermMergeState[] termsStates, int count) throws IOException {
 
-    final TermRef.Comparator termComp = getTermComparator();
+    final BytesRef.Comparator termComp = getComparator();
 
     //System.out.println("merge terms field=" + mergeState.fieldInfo.name + " comp=" + termComp);
 
@@ -119,14 +119,14 @@
           matchCount++;
         }
         TermMergeState top = queue.top();
-        if (top == null || !top.current.termEquals(pending[0].current)) {
+        if (top == null || !top.current.bytesEquals(pending[0].current)) {
           break;
         }
       }
 
       if (matchCount > 0) {
         // Merge one term
-        final TermRef term = pending[0].current;
+        final BytesRef term = pending[0].current;
         //System.out.println("  merge term=" + term);
         final DocsConsumer docsConsumer = startTerm(term);
         final int numDocs = docsConsumer.merge(mergeState, match, matchCount);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/IntBlockCodec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/IntBlockCodec.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/IntBlockCodec.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/IntBlockCodec.java Sun Jan 17 17:44:08 2010
@@ -23,7 +23,6 @@
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.FieldsConsumer;
 import org.apache.lucene.index.codecs.FieldsProducer;
@@ -39,6 +38,7 @@
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexReader;
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexWriter;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
 
 public class IntBlockCodec extends Codec {
 
@@ -63,7 +63,7 @@
 
     success = false;
     try {
-      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docsWriter, TermRef.getUTF8SortedAsUTF16Comparator());
+      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docsWriter, BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {
@@ -96,7 +96,7 @@
                                                        fieldInfos,
                                                        si.name,
                                                        indexDivisor,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
     } finally {
       if (!success) {
@@ -110,7 +110,7 @@
                                                        dir, fieldInfos, si.name,
                                                        docsReader,
                                                        readBufferSize,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java Sun Jan 17 17:44:08 2010
@@ -30,7 +30,6 @@
 import org.apache.lucene.index.PositionsEnum;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.CompoundFileReader;
@@ -39,6 +38,7 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
 
 /** Exposes flex API on a pre-flex index, as a codec. */
 public class PreFlexFields extends FieldsProducer {
@@ -220,9 +220,9 @@
     }
 
     @Override
-    public TermRef.Comparator getTermComparator() {
+    public BytesRef.Comparator getComparator() {
       // Pre-flex indexes always sorted in UTF16 order
-      return TermRef.getUTF8SortedAsUTF16Comparator();
+      return BytesRef.getUTF8SortedAsUTF16Comparator();
     }
   }
 
@@ -231,8 +231,8 @@
     private FieldInfo fieldInfo;
     private final PreDocsEnum docsEnum;
     private boolean skipNext;
-    private TermRef current;
-    private final TermRef scratchTermRef = new TermRef();
+    private BytesRef current;
+    private final BytesRef scratchBytesRef = new BytesRef();
 
     public PreTermsEnum() throws IOException {
       docsEnum = new PreDocsEnum();
@@ -263,9 +263,9 @@
     }
 
     @Override
-    public TermRef.Comparator getTermComparator() {
+    public BytesRef.Comparator getComparator() {
       // Pre-flex indexes always sorted in UTF16 order
-      return TermRef.getUTF8SortedAsUTF16Comparator();
+      return BytesRef.getUTF8SortedAsUTF16Comparator();
     }
 
     @Override
@@ -279,7 +279,7 @@
     }
 
     @Override
-    public SeekStatus seek(TermRef term) throws IOException {
+    public SeekStatus seek(BytesRef term) throws IOException {
       if (Codec.DEBUG) {
         System.out.println("pff.seek term=" + term);
       }
@@ -287,15 +287,15 @@
       termEnum = getTermsDict().terms(new Term(fieldInfo.name, term.toString()));
       final Term t = termEnum.term();
 
-      final TermRef tr;
+      final BytesRef tr;
       if (t != null) {
-        tr = scratchTermRef;
-        scratchTermRef.copy(t.text());
+        tr = scratchBytesRef;
+        scratchBytesRef.copy(t.text());
       } else {
         tr = null;
       }
 
-      if (t != null && t.field() == fieldInfo.name && term.termEquals(tr)) {
+      if (t != null && t.field() == fieldInfo.name && term.bytesEquals(tr)) {
         current = tr;
         return SeekStatus.FOUND;
       } else if (t == null || t.field() != fieldInfo.name) {
@@ -308,14 +308,14 @@
     }
 
     @Override
-    public TermRef next() throws IOException {
+    public BytesRef next() throws IOException {
       if (skipNext) {
         skipNext = false;
         if (termEnum.term() == null) {
           return null;
         } else {
-          scratchTermRef.copy(termEnum.term().text());
-          return current = scratchTermRef;
+          scratchBytesRef.copy(termEnum.term().text());
+          return current = scratchBytesRef;
         }
       }
       if (termEnum.next()) {
@@ -327,8 +327,8 @@
           if (Codec.DEBUG) {
             System.out.println("  ok");
           }
-          scratchTermRef.copy(t.text());
-          current = scratchTermRef;
+          scratchBytesRef.copy(t.text());
+          current = scratchBytesRef;
           return current;
         } else {
           assert !t.field().equals(fieldInfo.name);  // make sure field name is interned
@@ -344,7 +344,7 @@
     }
 
     @Override
-    public TermRef term() {
+    public BytesRef term() {
       return current;
     }
 
@@ -355,6 +355,8 @@
 
     @Override
     public DocsEnum docs(Bits skipDocs) throws IOException {
+      // nocommit -- must assert that skipDocs "matches" the
+      // underlying deletedDocs?
       docsEnum.reset(termEnum, skipDocs);        
       return docsEnum;
     }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingCodec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingCodec.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingCodec.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingCodec.java Sun Jan 17 17:44:08 2010
@@ -23,7 +23,6 @@
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.standard.StandardDocsConsumer;
 import org.apache.lucene.index.codecs.standard.StandardDocsProducer;
@@ -39,6 +38,7 @@
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexReader;
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexWriter;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
 
 /** This codec "inlines" the postings for terms that have
  *  low docFreq.  It wraps another codec, which is used for
@@ -79,7 +79,7 @@
     // Terms dict
     success = false;
     try {
-      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, pulsingWriter, TermRef.getUTF8SortedAsUTF16Comparator());
+      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, pulsingWriter, BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {
@@ -110,7 +110,7 @@
                                                        fieldInfos,
                                                        si.name,
                                                        indexDivisor,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
     } finally {
       if (!success) {
@@ -125,7 +125,7 @@
                                                        dir, fieldInfos, si.name,
                                                        docsReader,
                                                        readBufferSize,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepCodec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepCodec.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepCodec.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepCodec.java Sun Jan 17 17:44:08 2010
@@ -23,7 +23,6 @@
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.TermRef;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.FieldsConsumer;
 import org.apache.lucene.index.codecs.FieldsProducer;
@@ -36,6 +35,7 @@
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexReader;
 import org.apache.lucene.index.codecs.standard.StandardTermsIndexWriter;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
 
 public class SepCodec extends Codec {
 
@@ -61,7 +61,7 @@
 
     success = false;
     try {
-      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docsWriter, TermRef.getUTF8SortedAsUTF16Comparator());
+      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docsWriter, BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {
@@ -93,7 +93,7 @@
                                                        fieldInfos,
                                                        si.name,
                                                        indexDivisor,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
     } finally {
       if (!success) {
@@ -107,7 +107,7 @@
                                                        dir, fieldInfos, si.name,
                                                        docsReader,
                                                        readBufferSize,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesReader.java Sun Jan 17 17:44:08 2010
@@ -18,13 +18,13 @@
  */
 
 import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 
 // Handles reading incremental UTF8 encoded terms
 final class DeltaBytesReader {
-  final TermRef term = new TermRef();
+  final BytesRef term = new BytesRef();
   final IndexInput in;
 
   DeltaBytesReader(IndexInput in) {
@@ -32,7 +32,7 @@
     term.bytes = new byte[10];
   }
 
-  void reset(TermRef text) {
+  void reset(BytesRef text) {
     term.copy(text);
   }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesWriter.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/DeltaBytesWriter.java Sun Jan 17 17:44:08 2010
@@ -19,7 +19,7 @@
 
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
 
@@ -37,7 +37,7 @@
     lastLength = 0;
   }
 
-  void write(TermRef text) throws IOException {
+  void write(BytesRef text) throws IOException {
     int start = 0;
     int upto = text.offset;
     final int length = text.length;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java Sun Jan 17 17:44:08 2010
@@ -22,7 +22,7 @@
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.SegmentInfo;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.util.ArrayUtil;
 
@@ -64,11 +64,11 @@
 
   final private IndexInput in;
   private volatile boolean indexLoaded;
-  private final TermRef.Comparator termComp;
+  private final BytesRef.Comparator termComp;
 
   final HashMap<FieldInfo,FieldIndexReader> fields = new HashMap<FieldInfo,FieldIndexReader>();
 
-  public SimpleStandardTermsIndexReader(Directory dir, FieldInfos fieldInfos, String segment, int indexDivisor, TermRef.Comparator termComp)
+  public SimpleStandardTermsIndexReader(Directory dir, FieldInfos fieldInfos, String segment, int indexDivisor, BytesRef.Comparator termComp)
     throws IOException {
 
     this.termComp = termComp;
@@ -246,7 +246,7 @@
     }
 
     @Override
-    public final void getIndexOffset(TermRef term, TermsIndexResult result) throws IOException {
+    public final void getIndexOffset(BytesRef term, TermsIndexResult result) throws IOException {
       // You must call loadTermsIndex if you had specified -1 for indexDivisor
       if (coreIndex == null) {
         throw new IllegalStateException("terms index was not loaded");
@@ -381,7 +381,7 @@
             blockPointer[upto] = blockUpto * BYTE_BLOCK_SIZE + blockOffset;
 
             /*
-            TermRef tr = new TermRef();
+            BytesRef tr = new BytesRef();
             tr.bytes = blocks[blockUpto];
             tr.offset = blockOffset;
             tr.length = thisTermLength;
@@ -441,7 +441,7 @@
         result.offset = fileOffset[idx];
       }
 
-      public final void getIndexOffset(TermRef term, TermsIndexResult result) throws IOException {
+      public final void getIndexOffset(BytesRef term, TermsIndexResult result) throws IOException {
 
         if (Codec.DEBUG) {
           System.out.println("getIndexOffset field=" + fieldInfo.name + " term=" + term + " indexLen = " + blockPointer.length + " numIndexTerms=" + fileOffset.length + " this=" + this + " numIndexedTerms=" + fileOffset.length);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexWriter.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexWriter.java Sun Jan 17 17:44:08 2010
@@ -22,7 +22,7 @@
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexFileNames;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.codecs.Codec;
 
 import java.util.List;
@@ -88,7 +88,7 @@
     }
 
     @Override
-    public boolean checkIndexTerm(TermRef text, int docFreq) throws IOException {
+    public boolean checkIndexTerm(BytesRef text, int docFreq) throws IOException {
       // First term is first indexed term:
       if (0 == (numTerms++ % termIndexInterval)) {
         final long termsPointer = termsOut.getFilePointer();

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java?rev=900166&r1=900165&r2=900166&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java Sun Jan 17 17:44:08 2010
@@ -23,7 +23,7 @@
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.TermRef;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.FieldsConsumer;
 import org.apache.lucene.index.codecs.FieldsProducer;
@@ -53,7 +53,7 @@
 
     success = false;
     try {
-      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docs, TermRef.getUTF8SortedAsUTF16Comparator());
+      FieldsConsumer ret = new StandardTermsDictWriter(indexWriter, state, docs, BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {
@@ -80,7 +80,7 @@
                                                        fieldInfos,
                                                        si.name,
                                                        indexDivisor,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
     } finally {
       if (!success) {
@@ -94,7 +94,7 @@
                                                        dir, fieldInfos, si.name,
                                                        docs,
                                                        readBufferSize,
-                                                       TermRef.getUTF8SortedAsUTF16Comparator());
+                                                       BytesRef.getUTF8SortedAsUTF16Comparator());
       success = true;
       return ret;
     } finally {



Mime
View raw message