FAQ
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

  • Mark Miller at Aug 29, 2007 at 2:11 pm
    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: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedAug 29, '07 at 1:53p
activeAug 29, '07 at 2:11p
posts2
users2
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase