diff --git a/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java b/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java index 1498cc1a714..ce326ce7fea 100644 --- a/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java +++ b/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java @@ -105,7 +105,6 @@ public class FieldNormModifier { 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 @@ public class FieldNormModifier { 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 @@ public class FieldNormModifier { 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]))); } diff --git a/src/java/org/apache/lucene/index/MultiReader.java b/src/java/org/apache/lucene/index/MultiReader.java index 413b618891e..132fdf04e84 100644 --- a/src/java/org/apache/lucene/index/MultiReader.java +++ b/src/java/org/apache/lucene/index/MultiReader.java @@ -290,12 +290,6 @@ public class MultiReader extends IndexReader implements Cloneable { } 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 { diff --git a/src/java/org/apache/lucene/index/SegmentReader.java b/src/java/org/apache/lucene/index/SegmentReader.java index b17abf991b2..5aec0156868 100644 --- a/src/java/org/apache/lucene/index/SegmentReader.java +++ b/src/java/org/apache/lucene/index/SegmentReader.java @@ -988,14 +988,6 @@ public class SegmentReader extends IndexReader implements Cloneable { 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);