hi,

The match scorer does relevance scoring based on term frequency.  You can
configure it as a sort option:
QueryOptions.newBuilder()
    .setSortOptions(SortOptions.newBuilder()
        .setMatchScorer(MatchScorer.newBuilder()))
    ...
    .build();

then access the scores in the query results:
for (ScoredDocument scoredDoc : results) {
    out.println("Score: " + scoredDoc.getSortScores().get(**0));
}

If you access _score in a sort expression, e.g (suppose you have a field
called 'price'):

SortExpression sortExpr = SortExpression.newBuilder()
    .setExpression("price + _score")
    .setDefaultValueNumeric(0.0)
    .build();

then your SortOptions object should include a scorer. e.g.:

SortOptions.newBuilder()
    .setMatchScorer(MatchScorer.newBuilder())
    .addSortExpression(sortExpr)
    ...
    .build();

You might find the examples in this set of slides useful:
http://fts-webinar.appspot.com/ .  Both python and java examples are
included.



On 12 September 2012 12:42, jon <jonni.g...@gmail.com> wrote:

> I'm afraid my original question is still unanswered. I still don't know
> how to grab relevance score. I have a feeling that there's no Googler
> that's been assigned to look after FTS questions in this group :-(
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/bn2-B7VbApEJ.
>
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to