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 19:59:16 GMT
Cool, that worked, sort of.

The customScore method that is overridden from CustomScoreQuery has a
signature of:

public float customScore(final int doc, final float subQueryScore,
final float valSrcScore);

The javadoc states that the valSrcScore is the value from the field of
my ValueSourceQuery. But, the subQueryScore is actually my domainScore
(6.83) and the valSrcScore (0.06762122)seems to be the the lucene
subQueryScore.

Odd. Though, I know these classe are experimental.  I must have
something odd in there, but can't find it.




On Jan 28, 2008 2:35 PM, Tom Emerson <tremerson@gmail.com> wrote:
> Hi,
>
> In the constructor for your DomainCustomScoreQuery try calling
>
> setStrict(true);
>
> after invoking the superclass ctor. I think that will fix the problem you're
> seeing.
>
>
> 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"
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
>
> --
> Tom Emerson
> tremerson@gmail.com
> http://www.dreamersrealm.net/~tree
>



-- 
"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