lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r962851 - /lucene/dev/trunk/lucene/MIGRATE.txt
Date Sat, 10 Jul 2010 14:43:38 GMT
Author: mikemccand
Date: Sat Jul 10 14:43:37 2010
New Revision: 962851

URL: http://svn.apache.org/viewvc?rev=962851&view=rev
Log:
some corrections for flex migration, thanks to Andi Vajda

Modified:
    lucene/dev/trunk/lucene/MIGRATE.txt

Modified: lucene/dev/trunk/lucene/MIGRATE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/MIGRATE.txt?rev=962851&r1=962850&r2=962851&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/MIGRATE.txt (original)
+++ lucene/dev/trunk/lucene/MIGRATE.txt Sat Jul 10 14:43:37 2010
@@ -22,11 +22,42 @@ LUCENE-2380: FieldCache.getStrings/Index
       DocTerms values = FieldCache.DEFAULT.getTerms(reader, field);
       ...
       BytesRef term = new BytesRef();
-      String aValue = values.get(docID, term).utf8ToString();
+      String aValue = values.getTerm(docID, term).utf8ToString();
 
     Note however that it can be costly to convert to String, so it's
     better to work directly with the BytesRef.
 
+  * Similarly, in FieldCache, getStringIndex (returning a StringIndex
+    instance, with direct arrays int[] order and String[] lookup) has
+    been replaced with getTermsIndex (returning a
+    FieldCache.DocTermsIndex instance).  DocTermsIndex provides the
+    getOrd(int docID) method to lookup the int order for a document,
+    lookup(int ord, BytesRef reuse) to lookup the term from a given
+    order, and the sugar method getTerm(int docID, BytesRef reuse)
+    which internally calls getOrd and then lookup.
+
+    If you had code like this before:
+
+      StringIndex idx = FieldCache.DEFAULT.getStringIndex(reader, field);
+      ...
+      int ord = idx.order[docID];
+      String aValue = idx.lookup[ord];
+
+    you can do this instead:
+
+      DocTermsIndex idx = FieldCache.DEFAULT.getTermsIndex(reader, field);
+      ...
+      int ord = idx.getOrd(docID);
+      BytesRef term = new BytesRef();
+      String aValue = idx.lookup(ord, term).utf8ToString();
+
+    Note however that it can be costly to convert to String, so it's
+    better to work directly with the BytesRef.
+
+    DocTermsIndex also has a getTermsEnum() method, which returns an
+    iterator (TermsEnum) over the term values in the index (ie,
+    iterates ord = 0..numOrd()-1).
+
   * StringComparatorLocale is now more CPU costly than it was before
     (it was already very CPU costly since it does not compare using
     indexed collation keys; use CollationKeyFilter for better
@@ -101,6 +132,30 @@ LUCENE-1458, LUCENE-2111: Flexible Index
 	  ...
 	}
 
+      The bulk read API has also changed.  Instead of this:
+
+        int[] docs = new int[256];
+        int[] freqs = new int[256];
+
+        while(true) {
+          int count = td.read(docs, freqs)
+          if (count == 0) {
+            break;
+          }
+          // use docs[i], freqs[i]
+        }
+
+      do this:
+
+        DocsEnum.BulkReadResult bulk = td.getBulkResult();
+        while(true) {
+          int count = td.read();
+          if (count == 0) {
+            break;
+          }
+          // use bulk.docs.ints[i] and bulk.freqs.ints[i]
+        }
+
     * TermPositions is renamed to DocsAndPositionsEnum, and no longer
       extends the docs only enumerator (DocsEnum).
 



Mime
View raw message