I am trying to 'muck' with document scores from Lucene.  I have
certain business rules where I have a field named 'domainScore' within
my index.  The 'domainScore' value is a float.  What I want to do is
add this value to the document sub query score from the Lucene search.
 I have implemented a CustomScoreQuery that receives an instance of a
FieldScoreQuery which defines the fieldName 'domainScore' and the
value being type float:

//helper method that creates my query
final Query query = createQuery("content", criteria);

//create a new instance of my custom score query
CustomScoreQuery customScoreQuery = new  DomainCustomScoreQuery(query,
                new FieldScoreQuery("domainScore", FieldScoreQuery.Type.FLOAT));


//this extends CustomScoreQuery
public DomainCustomScoreQuery(final Query query, final
ValueSourceQuery valueSourceQuery) {
  super(query, valueSourceQuery);
}

 @Override
public float customScore(final int doc, final float subQueryScore,
final float valSrcScore) {

  final float totalScore;

  //shouldn't the valSrcScore be my 'domainScore' value?

   //don't worry about the calculateScore, that is where I do some
calculations based on the lucene document score and my domainScore
  totalScore = calculateScore(subQueryScore, valSrcScore);

  return totalScore;
}


So, that seems easy enough.  The issue I have is the valSrcScore is
not the value of the 'domainScore' I have in the index.  For instance,
my 'domainScore' field value for the document returned is '15.83'  but
the 'valSrcScore' passed to the customScore method is '8.614598'.
What am I missing?  The examples seem easy enough.

Thanks for your time,

Briggs.


-- 
"Conscious decisions by conscious minds are what make reality real"

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to