Index: contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java =================================================================== --- contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (revision 834718) +++ contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (working copy) @@ -43,7 +43,6 @@ import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermVectorOffsetInfo; -import org.apache.lucene.search.DefaultSimilarity; import org.apache.lucene.search.Similarity; import org.apache.lucene.util.StringHelper; import org.apache.lucene.util.AttributeImpl; @@ -202,9 +201,9 @@ byte[] oldNorms = index.getNormsByFieldNameAndDocumentNumber().get(field); if (oldNorms != null) { System.arraycopy(oldNorms, 0, norms, 0, oldNorms.length); - Arrays.fill(norms, oldNorms.length, norms.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(norms, oldNorms.length, norms.length, similarity.encodeNorm(1.0f)); } else { - Arrays.fill(norms, 0, norms.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(norms, 0, norms.length, similarity.encodeNorm(1.0f)); } normsByFieldNameAndDocumentNumber.put(field, norms); fieldNames.remove(field); @@ -212,7 +211,7 @@ for (String field : fieldNames) { //System.out.println(field); byte[] norms = new byte[index.getDocumentsByNumber().length + termDocumentInformationFactoryByDocument.size()]; - Arrays.fill(norms, 0, norms.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(norms, 0, norms.length, similarity.encodeNorm(1.0f)); normsByFieldNameAndDocumentNumber.put(field, norms); } fieldNames.clear(); @@ -240,7 +239,7 @@ float norm = eFieldTermDocInfoFactoriesByTermText.getKey().boost; norm *= document.getDocument().getBoost(); norm *= similarity.lengthNorm(eFieldTermDocInfoFactoriesByTermText.getKey().fieldName, eFieldTermDocInfoFactoriesByTermText.getKey().fieldLength); - normsByFieldNameAndDocumentNumber.get(eFieldTermDocInfoFactoriesByTermText.getKey().fieldName)[document.getDocumentNumber()] = Similarity.encodeNorm(norm); + normsByFieldNameAndDocumentNumber.get(eFieldTermDocInfoFactoriesByTermText.getKey().fieldName)[document.getDocumentNumber()] = similarity.encodeNorm(norm); } else { System.currentTimeMillis(); } Index: contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java =================================================================== --- contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (revision 834718) +++ contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (working copy) @@ -1102,7 +1102,7 @@ float boost = info != null ? info.getBoost() : 1.0f; FieldInvertState invertState = new FieldInvertState(0, numTokens, numOverlapTokens, 0, boost); float n = sim.computeNorm(fieldName, invertState); - byte norm = Similarity.encodeNorm(n); + byte norm = sim.encodeNorm(n); norms = new byte[] {norm}; // cache it for future reuse Index: contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java =================================================================== --- contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (revision 834718) +++ contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (working copy) @@ -147,7 +147,7 @@ if (sim == null) reader.setNorm(d, fieldName, fakeNorms[0]); else - reader.setNorm(d, fieldName, Similarity.encodeNorm(sim.lengthNorm(fieldName, termCounts[d]))); + reader.setNorm(d, fieldName, sim.encodeNorm(sim.lengthNorm(fieldName, termCounts[d]))); } } Index: contrib/misc/src/java/org/apache/lucene/misc/LengthNormModifier.java =================================================================== --- contrib/misc/src/java/org/apache/lucene/misc/LengthNormModifier.java (revision 834699) +++ contrib/misc/src/java/org/apache/lucene/misc/LengthNormModifier.java (working copy) @@ -141,7 +141,7 @@ reader = IndexReader.open(dir, false); for (int d = 0; d < termCounts.length; d++) { if (! reader.isDeleted(d)) { - byte norm = Similarity.encodeNorm(sim.lengthNorm(fieldName, termCounts[d])); + byte norm = sim.encodeNorm(sim.lengthNorm(fieldName, termCounts[d])); reader.setNorm(d, fieldName, norm); } } Index: contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java =================================================================== --- contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (revision 834718) +++ contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (working copy) @@ -44,9 +44,7 @@ public TestFieldNormModifier(String name) { super(name); } - - public static byte DEFAULT_NORM = Similarity.encodeNorm(1.0f); - + public static int NUM_DOCS = 5; public Directory store = new RAMDirectory(); Index: contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java =================================================================== --- contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (revision 834718) +++ contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (working copy) @@ -47,8 +47,6 @@ public TestLengthNormModifier(String name) { super(name); } - - public static byte DEFAULT_NORM = Similarity.encodeNorm(1.0f); public static int NUM_DOCS = 5; Index: src/java/org/apache/lucene/index/DirectoryReader.java =================================================================== --- src/java/org/apache/lucene/index/DirectoryReader.java (revision 834718) +++ src/java/org/apache/lucene/index/DirectoryReader.java (working copy) @@ -31,7 +31,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldSelector; -import org.apache.lucene.search.DefaultSimilarity; +import org.apache.lucene.search.Similarity; import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.store.Directory; import org.apache.lucene.store.Lock; @@ -604,7 +604,7 @@ ensureOpen(); byte[] bytes = normsCache.get(field); if (bytes==null && !hasNorms(field)) { - Arrays.fill(result, offset, result.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(result, offset, result.length, Similarity.getDefault().encodeNorm(1.0f)); } else if (bytes != null) { // cache hit System.arraycopy(bytes, 0, result, offset, maxDoc()); } else { Index: src/java/org/apache/lucene/index/IndexReader.java =================================================================== --- src/java/org/apache/lucene/index/IndexReader.java (revision 834718) +++ src/java/org/apache/lucene/index/IndexReader.java (working copy) @@ -761,7 +761,7 @@ public void setNorm(int doc, String field, float value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); - setNorm(doc, field, Similarity.encodeNorm(value)); + setNorm(doc, field, Similarity.getDefault().encodeNorm(value)); } /** Returns an enumeration of all the terms in the index. The Index: src/java/org/apache/lucene/index/MultiReader.java =================================================================== --- src/java/org/apache/lucene/index/MultiReader.java (revision 834718) +++ src/java/org/apache/lucene/index/MultiReader.java (working copy) @@ -29,6 +29,7 @@ import org.apache.lucene.index.DirectoryReader.MultiTermEnum; import org.apache.lucene.index.DirectoryReader.MultiTermPositions; import org.apache.lucene.search.DefaultSimilarity; +import org.apache.lucene.search.Similarity; /** An IndexReader which reads multiple indexes, appending * their content. */ @@ -322,7 +323,7 @@ subReaders[i].norms(field, result, offset + starts[i]); if (bytes==null && !hasNorms(field)) { - Arrays.fill(result, offset, result.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(result, offset, result.length, Similarity.getDefault().encodeNorm(1.0f)); } else if (bytes != null) { // cache hit System.arraycopy(bytes, 0, result, offset, maxDoc()); } else { Index: src/java/org/apache/lucene/index/NormsWriter.java =================================================================== --- src/java/org/apache/lucene/index/NormsWriter.java (revision 834718) +++ src/java/org/apache/lucene/index/NormsWriter.java (working copy) @@ -39,7 +39,7 @@ @SuppressWarnings("unchecked") final class NormsWriter extends InvertedDocEndConsumer { - private static final byte defaultNorm = Similarity.encodeNorm(1.0f); + private static final byte defaultNorm = Similarity.getDefault().encodeNorm(1.0f); private FieldInfos fieldInfos; @Override public InvertedDocEndConsumerPerThread addThread(DocInverterPerThread docInverterPerThread) { Index: src/java/org/apache/lucene/index/NormsWriterPerField.java =================================================================== --- src/java/org/apache/lucene/index/NormsWriterPerField.java (revision 834718) +++ src/java/org/apache/lucene/index/NormsWriterPerField.java (working copy) @@ -71,7 +71,7 @@ norms = ArrayUtil.grow(norms, 1+upto); } final float norm = docState.similarity.computeNorm(fieldInfo.name, fieldState); - norms[upto] = Similarity.encodeNorm(norm); + norms[upto] = Similarity.getDefault().encodeNorm(norm); docIDs[upto] = docState.docID; upto++; } Index: src/java/org/apache/lucene/index/SegmentReader.java =================================================================== --- src/java/org/apache/lucene/index/SegmentReader.java (revision 834718) +++ src/java/org/apache/lucene/index/SegmentReader.java (working copy) @@ -30,7 +30,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldSelector; -import org.apache.lucene.search.DefaultSimilarity; +import org.apache.lucene.search.Similarity; import org.apache.lucene.store.BufferedIndexInput; import org.apache.lucene.store.Directory; import org.apache.lucene.store.IndexInput; @@ -990,7 +990,7 @@ static byte[] createFakeNorms(int size) { byte[] ones = new byte[size]; - Arrays.fill(ones, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(ones, Similarity.getDefault().encodeNorm(1.0f)); return ones; } @@ -1030,7 +1030,7 @@ ensureOpen(); Norm norm = norms.get(field); if (norm == null) { - Arrays.fill(bytes, offset, bytes.length, DefaultSimilarity.encodeNorm(1.0f)); + Arrays.fill(bytes, offset, bytes.length, Similarity.getDefault().encodeNorm(1.0f)); return; } Index: src/java/org/apache/lucene/search/MatchAllDocsQuery.java =================================================================== --- src/java/org/apache/lucene/search/MatchAllDocsQuery.java (revision 834718) +++ src/java/org/apache/lucene/search/MatchAllDocsQuery.java (working copy) @@ -70,7 +70,7 @@ @Override public float score() { - return norms == null ? score : score * Similarity.decodeNorm(norms[docID()]); + return norms == null ? score : score * getSimilarity().decodeNorm(norms[docID()]); } @Override Index: src/java/org/apache/lucene/search/MultiPhraseQuery.java =================================================================== --- src/java/org/apache/lucene/search/MultiPhraseQuery.java (revision 834718) +++ src/java/org/apache/lucene/search/MultiPhraseQuery.java (working copy) @@ -238,7 +238,7 @@ Explanation fieldNormExpl = new Explanation(); byte[] fieldNorms = reader.norms(field); float fieldNorm = - fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 1.0f; + fieldNorms!=null ? similarity.decodeNorm(fieldNorms[doc]) : 1.0f; fieldNormExpl.setValue(fieldNorm); fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")"); fieldExpl.addDetail(fieldNormExpl); Index: src/java/org/apache/lucene/search/PhraseQuery.java =================================================================== --- src/java/org/apache/lucene/search/PhraseQuery.java (revision 834718) +++ src/java/org/apache/lucene/search/PhraseQuery.java (working copy) @@ -108,7 +108,7 @@ } private class PhraseWeight extends Weight { - private Similarity similarity; + private final Similarity similarity; private float value; private float idf; private float queryNorm; @@ -232,7 +232,7 @@ Explanation fieldNormExpl = new Explanation(); byte[] fieldNorms = reader.norms(field); float fieldNorm = - fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 1.0f; + fieldNorms!=null ? similarity.decodeNorm(fieldNorms[doc]) : 1.0f; fieldNormExpl.setValue(fieldNorm); fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")"); fieldExpl.addDetail(fieldNormExpl); Index: src/java/org/apache/lucene/search/PhraseScorer.java =================================================================== --- src/java/org/apache/lucene/search/PhraseScorer.java (revision 834718) +++ src/java/org/apache/lucene/search/PhraseScorer.java (working copy) @@ -110,7 +110,7 @@ public float score() throws IOException { //System.out.println("scoring " + first.doc); float raw = getSimilarity().tf(freq) * value; // raw score - return norms == null ? raw : raw * Similarity.decodeNorm(norms[first.doc]); // normalize + return norms == null ? raw : raw * getSimilarity().decodeNorm(norms[first.doc]); // normalize } @Override Index: src/java/org/apache/lucene/search/Scorer.java =================================================================== --- src/java/org/apache/lucene/search/Scorer.java (revision 834718) +++ src/java/org/apache/lucene/search/Scorer.java (working copy) @@ -38,7 +38,7 @@ * with these scores. */ public abstract class Scorer extends DocIdSetIterator { - private Similarity similarity; + private final Similarity similarity; /** Constructs a Scorer. * @param similarity The Similarity implementation used by this scorer. Index: src/java/org/apache/lucene/search/Similarity.java =================================================================== --- src/java/org/apache/lucene/search/Similarity.java (revision 834718) +++ src/java/org/apache/lucene/search/Similarity.java (working copy) @@ -26,7 +26,6 @@ import java.io.IOException; import java.io.Serializable; import java.util.Collection; -import java.util.IdentityHashMap; /** @@ -566,17 +565,10 @@ /** Decodes a normalization factor stored in an index. * @see #encodeNorm(float) */ - public static float decodeNorm(byte b) { + public float decodeNorm(byte b) { return NORM_TABLE[b & 0xFF]; // & 0xFF maps negative bytes to positive above 127 } - /** Returns a table for decoding normalization bytes. - * @see #encodeNorm(float) - */ - public static float[] getNormDecoder() { - return NORM_TABLE; - } - /** * Compute the normalization value for a field, given the accumulated * state of term processing for this field (see {@link FieldInvertState}). @@ -654,7 +646,7 @@ * @see org.apache.lucene.document.Field#setBoost(float) * @see org.apache.lucene.util.SmallFloat */ - public static byte encodeNorm(float f) { + public byte encodeNorm(float f) { return SmallFloat.floatToByte315(f); } Index: src/java/org/apache/lucene/search/spans/SpanScorer.java =================================================================== --- src/java/org/apache/lucene/search/spans/SpanScorer.java (revision 834718) +++ src/java/org/apache/lucene/search/spans/SpanScorer.java (working copy) @@ -95,7 +95,7 @@ @Override public float score() throws IOException { float raw = getSimilarity().tf(freq) * value; // raw score - return norms == null? raw : raw * Similarity.decodeNorm(norms[doc]); // normalize + return norms == null? raw : raw * getSimilarity().decodeNorm(norms[doc]); // normalize } /** This method is no longer an official member of {@link Scorer}, Index: src/java/org/apache/lucene/search/spans/SpanWeight.java =================================================================== --- src/java/org/apache/lucene/search/spans/SpanWeight.java (revision 834718) +++ src/java/org/apache/lucene/search/spans/SpanWeight.java (working copy) @@ -118,7 +118,7 @@ Explanation fieldNormExpl = new Explanation(); byte[] fieldNorms = reader.norms(field); float fieldNorm = - fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 1.0f; + fieldNorms!=null ? similarity.decodeNorm(fieldNorms[doc]) : 1.0f; fieldNormExpl.setValue(fieldNorm); fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")"); fieldExpl.addDetail(fieldNormExpl); Index: src/java/org/apache/lucene/search/TermQuery.java =================================================================== --- src/java/org/apache/lucene/search/TermQuery.java (revision 834718) +++ src/java/org/apache/lucene/search/TermQuery.java (working copy) @@ -33,7 +33,7 @@ private Term term; private class TermWeight extends Weight { - private Similarity similarity; + private final Similarity similarity; private float value; private float idf; private float queryNorm; @@ -135,7 +135,7 @@ Explanation fieldNormExpl = new Explanation(); byte[] fieldNorms = reader.norms(field); float fieldNorm = - fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 1.0f; + fieldNorms!=null ? similarity.decodeNorm(fieldNorms[doc]) : 1.0f; fieldNormExpl.setValue(fieldNorm); fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")"); fieldExpl.addDetail(fieldNormExpl); Index: src/java/org/apache/lucene/search/TermScorer.java =================================================================== --- src/java/org/apache/lucene/search/TermScorer.java (revision 834718) +++ src/java/org/apache/lucene/search/TermScorer.java (working copy) @@ -25,7 +25,7 @@ */ final class TermScorer extends Scorer { - private static final float[] SIM_NORM_DECODER = Similarity.getNormDecoder(); +// private static final float[] SIM_NORM_DECODER = Similarity.getNormDecoder(); private Weight weight; private TermDocs termDocs; @@ -56,6 +56,7 @@ */ TermScorer(Weight weight, TermDocs td, Similarity similarity, byte[] norms) { super(similarity); + this.weight = weight; this.termDocs = td; this.norms = norms; @@ -127,7 +128,7 @@ ? scoreCache[f] // cache hit : getSimilarity().tf(f)*weightValue; // cache miss - return norms == null ? raw : raw * SIM_NORM_DECODER[norms[doc] & 0xFF]; // normalize for field + return norms == null ? raw : raw * getSimilarity().decodeNorm(norms[doc]); // normalize for field } /** Index: src/test/org/apache/lucene/index/TestIndexReader.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexReader.java (revision 834718) +++ src/test/org/apache/lucene/index/TestIndexReader.java (working copy) @@ -511,7 +511,7 @@ // is open against the index: public void testWritingNorms() throws IOException { - String tempDir = System.getProperty("tempDir"); + String tempDir = "target/test"; if (tempDir == null) throw new IOException("tempDir undefined, cannot run test"); Index: src/test/org/apache/lucene/index/TestIndexReaderClone.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexReaderClone.java (revision 834718) +++ src/test/org/apache/lucene/index/TestIndexReaderClone.java (working copy) @@ -273,13 +273,13 @@ * @throws Exception */ private void performDefaultTests(IndexReader r1) throws Exception { - float norm1 = Similarity.decodeNorm(r1.norms("field1")[4]); + float norm1 = Similarity.getDefault().decodeNorm(r1.norms("field1")[4]); IndexReader pr1Clone = (IndexReader) r1.clone(); pr1Clone.deleteDocument(10); pr1Clone.setNorm(4, "field1", 0.5f); - assertTrue(Similarity.decodeNorm(r1.norms("field1")[4]) == norm1); - assertTrue(Similarity.decodeNorm(pr1Clone.norms("field1")[4]) != norm1); + assertTrue(Similarity.getDefault().decodeNorm(r1.norms("field1")[4]) == norm1); + assertTrue(Similarity.getDefault().decodeNorm(pr1Clone.norms("field1")[4]) != norm1); assertTrue(!r1.isDeleted(10)); assertTrue(pr1Clone.isDeleted(10)); @@ -426,7 +426,7 @@ TestIndexReaderReopen.createIndex(dir1, false); IndexReader orig = IndexReader.open(dir1, false); orig.setNorm(1, "field1", 17.0f); - final byte encoded = Similarity.encodeNorm(17.0f); + final byte encoded = Similarity.getDefault().encodeNorm(17.0f); assertEquals(encoded, orig.norms("field1")[1]); // the cloned segmentreader should have 2 references, 1 to itself, and 1 to Index: src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (revision 834718) +++ src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (working copy) @@ -216,7 +216,8 @@ } // norm values should be different - assertTrue(Similarity.decodeNorm(segmentReader3C.norms("field1")[5]) != Similarity.decodeNorm(segmentReader4C.norms("field1")[5])); + assertTrue(Similarity.getDefault().decodeNorm(segmentReader3C.norms("field1")[5]) + != Similarity.getDefault().decodeNorm(segmentReader4C.norms("field1")[5])); Norm reader4CCNorm = segmentReader4C.norms.get("field1"); assertEquals(3, reader3CCNorm.bytesRef().refCount()); assertEquals(1, reader4CCNorm.bytesRef().refCount()); @@ -283,7 +284,7 @@ assertEquals("number of norms mismatches", numDocNorms, b.length); ArrayList storedNorms = (i == 1 ? modifiedNorms : norms); for (int j = 0; j < b.length; j++) { - float norm = Similarity.decodeNorm(b[j]); + float norm = Similarity.getDefault().decodeNorm(b[j]); float norm1 = ((Float) storedNorms.get(j)).floatValue(); assertEquals("stored norm value of " + field + " for doc " + j + " is " + norm + " - a mismatch!", norm, norm1, 0.000001); @@ -321,7 +322,8 @@ private float nextNorm() { float norm = lastNorm + normDelta; do { - float norm1 = Similarity.decodeNorm(Similarity.encodeNorm(norm)); + float norm1 = Similarity.getDefault().decodeNorm( + Similarity.getDefault().encodeNorm(norm)); if (norm1 > lastNorm) { // System.out.println(norm1+" > "+lastNorm); norm = norm1; Index: src/test/org/apache/lucene/index/TestNorms.java =================================================================== --- src/test/org/apache/lucene/index/TestNorms.java (revision 834718) +++ src/test/org/apache/lucene/index/TestNorms.java (working copy) @@ -189,7 +189,7 @@ assertEquals("number of norms mismatches",numDocNorms,b.length); ArrayList storedNorms = (i==1 ? modifiedNorms : norms); for (int j = 0; j < b.length; j++) { - float norm = Similarity.decodeNorm(b[j]); + float norm = similarityOne.decodeNorm(b[j]); float norm1 = ((Float)storedNorms.get(j)).floatValue(); assertEquals("stored norm value of "+field+" for doc "+j+" is "+norm+" - a mismatch!", norm, norm1, 0.000001); } @@ -224,7 +224,7 @@ private float nextNorm() { float norm = lastNorm + normDelta; do { - float norm1 = Similarity.decodeNorm(Similarity.encodeNorm(norm)); + float norm1 = similarityOne.decodeNorm(similarityOne.encodeNorm(norm)); if (norm1 > lastNorm) { //System.out.println(norm1+" > "+lastNorm); norm = norm1; Index: src/test/org/apache/lucene/index/TestSegmentReader.java =================================================================== --- src/test/org/apache/lucene/index/TestSegmentReader.java (revision 834718) +++ src/test/org/apache/lucene/index/TestSegmentReader.java (working copy) @@ -26,7 +26,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Fieldable; -import org.apache.lucene.search.DefaultSimilarity; +import org.apache.lucene.search.Similarity; import org.apache.lucene.store.RAMDirectory; public class TestSegmentReader extends LuceneTestCase { @@ -167,7 +167,7 @@ if (!reader.hasNorms(f.name())) { // test for fake norms of 1.0 or null depending on the flag byte [] norms = reader.norms(f.name()); - byte norm1 = DefaultSimilarity.encodeNorm(1.0f); + byte norm1 = Similarity.getDefault().encodeNorm(1.0f); assertNull(norms); norms = new byte[reader.maxDoc()]; reader.norms(f.name(),norms, 0);