lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vaijanath Rao <vaiju1...@gmail.com>
Subject Help with Scorer
Date Sun, 15 Apr 2012 10:56:31 GMT
Hi,

I am currently facing a problem with the scorer.  What I want is to add
score to original score based on the certain logic.

Here is snippet for the code

public class AddAdditioanlWeight extends Weight {

    private Query internalQuery = null;
    private Scorer subScorer =null;
    private Weight internalWeight = null;


  public AddAdditioanlWeight(Searcher searcher, Query query) throws
IOException {
     this.internalQuery = query;
     internalWeight = query.createWeight(searcher); // create weight based
on the originalQuery
  }

    @Override
    public Query getQuery() {
        return null;
    }

    @Override
    public float getValue() {
        return 0;
    }

    @Override
    public void normalize(float arg0) {

    }

    public AdditionalScorer scorer(IndexReader reader, boolean
scoreDocsInOrder, boolean topScorer) throws IOException {
        subScorer = internalWeight.scorer(reader, scoreDocsInOrder,
topScorer);
        // I get the subScorer as null for termQuery or PhraseQuery and
others.

    }
}

The problem I am running into is that the subScorer is always null can
someone help me in figuring out issue with my snippet code.

--Thanks and Regards
Vaijanath


-- 
I am feeling fine, healthier and Happier, what about you

Mime
View raw message