Package com.google.appengine.api.search
Class MatchScorer
java.lang.Object
com.google.appengine.api.search.MatchScorer
- Direct Known Subclasses:
RescoringMatchScorer
Assigns a document score based on frequency of terms in TextFields and HTMLFields.
If you add a MatchScorer to a SortOptions as in the following code:
SortOptions sortOptions = SortOptions.newBuilder()
.setMatchScorer(MatchScorer.newBuilder())
.build();
then this will sort the documents in descending score order. The scores will be positive. If you
want to sort in ascending order, then use the following code:
SortOptions sortOptions = SortOptions.newBuilder()
.setMatchScorer(MatchScorer.newBuilder())
.addSortExpression(
SortExpression.newBuilder()
.setExpression(SortExpression.SCORE_FIELD_NAME)
.setDirection(SortExpression.SortDirection.ASCENDING)
.setDefaultValueNumeric(0.0))
.build();
In this example, the score will be negative.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic MatchScorer.Builder
Creates and returns a MatchScorer Builder.toString()
-
Method Details
-
newBuilder
Creates and returns a MatchScorer Builder.- Returns:
- a new
MatchScorer.Builder
. Set the parameters for scorer on the Builder, and use theMatchScorer.Builder.build()
method to create a concrete instance of MatchScorer
-
toString
-