mirror of https://github.com/apache/lucene.git
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:
parent
b50794e1ec
commit
444dae0a2f
|
@ -105,7 +105,6 @@ public class FieldNormModifier {
|
||||||
public void reSetNorms(String field) throws IOException {
|
public void reSetNorms(String field) throws IOException {
|
||||||
String fieldName = StringHelper.intern(field);
|
String fieldName = StringHelper.intern(field);
|
||||||
int[] termCounts = new int[0];
|
int[] termCounts = new int[0];
|
||||||
byte[] fakeNorms = new byte[0];
|
|
||||||
|
|
||||||
IndexReader reader = null;
|
IndexReader reader = null;
|
||||||
TermEnum termEnum = null;
|
TermEnum termEnum = null;
|
||||||
|
@ -113,9 +112,6 @@ public class FieldNormModifier {
|
||||||
try {
|
try {
|
||||||
reader = IndexReader.open(dir, true);
|
reader = IndexReader.open(dir, true);
|
||||||
termCounts = new int[reader.maxDoc()];
|
termCounts = new int[reader.maxDoc()];
|
||||||
// if we are killing norms, get fake ones
|
|
||||||
if (sim == null)
|
|
||||||
fakeNorms = SegmentReader.createFakeNorms(reader.maxDoc());
|
|
||||||
try {
|
try {
|
||||||
termEnum = reader.terms(new Term(field));
|
termEnum = reader.terms(new Term(field));
|
||||||
try {
|
try {
|
||||||
|
@ -145,7 +141,7 @@ public class FieldNormModifier {
|
||||||
for (int d = 0; d < termCounts.length; d++) {
|
for (int d = 0; d < termCounts.length; d++) {
|
||||||
if (! reader.isDeleted(d)) {
|
if (! reader.isDeleted(d)) {
|
||||||
if (sim == null)
|
if (sim == null)
|
||||||
reader.setNorm(d, fieldName, fakeNorms[0]);
|
reader.setNorm(d, fieldName, Similarity.encodeNorm(1.0f));
|
||||||
else
|
else
|
||||||
reader.setNorm(d, fieldName, Similarity.encodeNorm(sim.lengthNorm(fieldName, termCounts[d])));
|
reader.setNorm(d, fieldName, Similarity.encodeNorm(sim.lengthNorm(fieldName, termCounts[d])));
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,12 +290,6 @@ public class MultiReader extends IndexReader implements Cloneable {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] ones;
|
|
||||||
private byte[] fakeNorms() {
|
|
||||||
if (ones==null) ones=SegmentReader.createFakeNorms(maxDoc());
|
|
||||||
return ones;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized byte[] norms(String field) throws IOException {
|
public synchronized byte[] norms(String field) throws IOException {
|
||||||
|
|
|
@ -988,14 +988,6 @@ public class SegmentReader extends IndexReader implements Cloneable {
|
||||||
return norms.containsKey(field);
|
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
|
// can return null if norms aren't stored
|
||||||
protected synchronized byte[] getNorms(String field) throws IOException {
|
protected synchronized byte[] getNorms(String field) throws IOException {
|
||||||
Norm norm = norms.get(field);
|
Norm norm = norms.get(field);
|
||||||
|
|
Loading…
Reference in New Issue