lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Briggs <acidbri...@gmail.com>
Subject Re: CustomScoreQuery Not Returning Value in Index
Date Mon, 28 Jan 2008 17:55:22 GMT
One correction, my valSrcScore was '0.7002756' not ''8.614598'.  But,
again, it's not what I expected.

On Jan 28, 2008 12:34 PM, Briggs <acidbriggs@gmail.com> wrote:
> 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"
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message