I think that encodeNorm and decodeNorm on Similarity are really just
utility methods for norm encode/decode. It would be nice to be able to
override those if you wanted to change the encode/decode method, but you
should be able to modify the norm elsewhere. Actual access to the norm
information is handled in IndexReader and this behavior can be
overridden. This short example would hide the norms stored in the index
and instead return 1.0f for each doc:
public class FakeNormsIndexReader extends FilterIndexReader {
byte[] ones = SegmentReader.createFakeNorms(maxDoc());
public FakeNormsIndexReader(IndexReader in) {
super(in);
}
public synchronized byte[] norms(String field) throws IOException {
return ones;
}
public synchronized void norms(String field, byte[] result, int
offset) {
System.arraycopy(ones, 0, result, offset, maxDoc());
}
}
- Mark
Emmanuel Franquemagne wrote:
Hello,
I'd like to know if there is a way to perform custom correction to the
similarity norm before it is written
At best, we wished we could do this by extending the Similarity class,
but encodeNorm, that would be the best place to do it, is a static
method and thus it's no use to override it.
Is there a reason why this method is static? And is there any solution
that could allow us to do this value correction?
Thanks for any help,
Emmanuel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]