Remove dead code from old fake norms. FieldNormModifier now creates the fake itsself.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@835279 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-11-12 07:25:42 +00:00
parent b50794e1ec
commit 444dae0a2f
3 changed files with 1 additions and 19 deletions

View File

@ -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])));
}

View File

@ -291,12 +291,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 {
ensureOpen();

View File

@ -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);