You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/01/11 16:35:20 UTC

svn commit: r1432096 - in /lucene/dev/trunk/lucene: CHANGES.txt core/src/java/org/apache/lucene/index/Norm.java core/src/test/org/apache/lucene/index/TestCustomNorms.java

Author: rmuir
Date: Fri Jan 11 15:35:19 2013
New Revision: 1432096

URL: http://svn.apache.org/viewvc?rev=1432096&view=rev
Log:
LUCENE-4540: revert

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/Norm.java
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1432096&r1=1432095&r2=1432096&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Fri Jan 11 15:35:19 2013
@@ -152,11 +152,6 @@ New Features
 * LUCENE-4515: MemoryIndex now supports adding the same field multiple
   times. (Simon Willnauer)
 
-* LUCENE-4540: Added an experimental Norm.setPackedLong, which allows
-  the use of VAR_INTS-encoded norms. This can be useful for cases where
-  you only need a few bits per-document, or where you might want exact
-  document length, and so on.  (Robert Muir)
-
 * LUCENE-4489: Added consumeAllTokens option to LimitTokenCountFilter
   (hossman, Robert Muir)
 

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/Norm.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/Norm.java?rev=1432096&r1=1432095&r2=1432096&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/Norm.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/Norm.java Fri Jan 11 15:35:19 2013
@@ -115,15 +115,6 @@ public final class Norm  {
     setType(Type.FIXED_INTS_64);
     this.field.setLongValue(norm);
   }
-  
-  /**
-   * Sets a packed long norm value.
-   * @lucene.experimental
-   */
-  public void setPackedLong(long norm) {
-    setType(Type.VAR_INTS);
-    this.field.setLongValue(norm);
-  }
 
   /**
    * Sets a byte norm value

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java?rev=1432096&r1=1432095&r2=1432096&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java Fri Jan 11 15:35:19 2013
@@ -22,7 +22,6 @@ import java.util.Random;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
 import org.apache.lucene.index.DocValues.Source;
 import org.apache.lucene.index.DocValues.Type;
@@ -31,12 +30,14 @@ import org.apache.lucene.search.TermStat
 import org.apache.lucene.search.similarities.DefaultSimilarity;
 import org.apache.lucene.search.similarities.PerFieldSimilarityWrapper;
 import org.apache.lucene.search.similarities.Similarity;
+import org.apache.lucene.search.similarities.Similarity.ExactSimScorer;
+import org.apache.lucene.search.similarities.Similarity.SimWeight;
+import org.apache.lucene.search.similarities.Similarity.SloppySimScorer;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LineFileDocs;
 import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
 
 /**
  * 
@@ -86,39 +87,6 @@ public class TestCustomNorms extends Luc
     dir.close();
     docs.close();
   }
-  
-  public void testPackedNorms() throws IOException {
-    Directory dir = newDirectory();
-    IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
-    config.setSimilarity(new PackedNormSimilarity());
-    RandomIndexWriter writer = new RandomIndexWriter(random(), dir, config);
-    int num = _TestUtil.nextInt(random(), 1, 1000);
-    for (int i = 0; i < num; i++) {
-      Document doc = new Document();
-      doc.add(new StringField("len", Integer.toString(i), Field.Store.YES));
-      StringBuilder sb = new StringBuilder();
-      for (int j = 0; j < i; j++) {
-        sb.append(" token");
-      }
-      doc.add(new TextField("content", sb.toString(), Field.Store.NO));
-      writer.addDocument(doc);
-    }
-    
-    DirectoryReader ir = writer.getReader();
-    writer.close();
-    for (AtomicReaderContext context : ir.leaves()) {
-      AtomicReader reader = context.reader();
-      DocValues norms = reader.normValues("content");
-      assertNotNull(norms);
-      Source source = norms.getSource();
-      assertEquals(Type.VAR_INTS, source.getType());
-      for (int i = 0; i < reader.maxDoc(); i++) {
-        assertEquals(source.getInt(i), Long.parseLong(reader.document(i).get("len")));
-      }
-    }
-    ir.close();
-    dir.close();
-  }
 
   public void testExceptionOnRandomType() throws IOException {
     Directory dir = newDirectory();
@@ -334,28 +302,5 @@ public class TestCustomNorms extends Luc
       throw new UnsupportedOperationException();
     }
   }
-  
-  class PackedNormSimilarity extends Similarity {
-
-    @Override
-    public void computeNorm(FieldInvertState state, Norm norm) {
-      norm.setPackedLong(state.getLength());
-    }
-
-    @Override
-    public SimWeight computeWeight(float queryBoost, CollectionStatistics collectionStats, TermStatistics... termStats) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public ExactSimScorer exactSimScorer(SimWeight weight, AtomicReaderContext context) throws IOException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public SloppySimScorer sloppySimScorer(SimWeight weight, AtomicReaderContext context) throws IOException {
-      throw new UnsupportedOperationException();
-    }
-  }
 
 }