lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r835279 - in /lucene/java/trunk: contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java src/java/org/apache/lucene/index/MultiReader.java src/java/org/apache/lucene/index/SegmentReader.java
Date Thu, 12 Nov 2009 07:25:43 GMT
Author: uschindler
Date: Thu Nov 12 07:25:42 2009
New Revision: 835279

URL: http://svn.apache.org/viewvc?rev=835279&view=rev
Log:
Remove dead code from old fake norms. FieldNormModifier now creates the fake itsself.

Modified:
    lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
    lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java

Modified: lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java?rev=835279&r1=835278&r2=835279&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
(original)
+++ lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
Thu Nov 12 07:25:42 2009
@@ -105,7 +105,6 @@
   public void reSetNorms(String field) throws IOException {
     String fieldName = StringHelper.intern(field);
     int[] termCounts = new int[0];
-    byte[] fakeNorms = new byte[0];
     
     IndexReader reader = null;
     TermEnum termEnum = null;
@@ -113,9 +112,6 @@
     try {
       reader = IndexReader.open(dir, true);
       termCounts = new int[reader.maxDoc()];
-      // if we are killing norms, get fake ones
-      if (sim == null)
-        fakeNorms = SegmentReader.createFakeNorms(reader.maxDoc());
       try {
         termEnum = reader.terms(new Term(field));
         try {
@@ -145,7 +141,7 @@
       for (int d = 0; d < termCounts.length; d++) {
         if (! reader.isDeleted(d)) {
           if (sim == null)
-            reader.setNorm(d, fieldName, fakeNorms[0]);
+            reader.setNorm(d, fieldName, Similarity.encodeNorm(1.0f));
           else
             reader.setNorm(d, fieldName, Similarity.encodeNorm(sim.lengthNorm(fieldName,
termCounts[d])));
         }

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java?rev=835279&r1=835278&r2=835279&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java Thu Nov 12 07:25:42
2009
@@ -290,12 +290,6 @@
     }
     return false;
   }
-
-  private byte[] ones;
-  private byte[] fakeNorms() {
-    if (ones==null) ones=SegmentReader.createFakeNorms(maxDoc());
-    return ones;
-  }
   
   @Override
   public synchronized byte[] norms(String field) throws IOException {

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java?rev=835279&r1=835278&r2=835279&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java Thu Nov 12 07:25:42
2009
@@ -988,14 +988,6 @@
     return norms.containsKey(field);
   }
 
-  static byte[] createFakeNorms(int size) {
-    byte[] ones = new byte[size];
-    Arrays.fill(ones, DefaultSimilarity.encodeNorm(1.0f));
-    return ones;
-  }
-
-  private byte[] ones;
-
   // can return null if norms aren't stored
   protected synchronized byte[] getNorms(String field) throws IOException {
     Norm norm = norms.get(field);



Mime
View raw message