1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.search
.checkers
;
5 import com
.google
.appengine
.api
.search
.SearchServicePb
.SortSpec
;
8 * Checks the values of a {@link SortExpression}.
11 public class SortExpressionChecker
{
14 * Checks the {@link ScorerSpec} is valid, specifically checking the limit
15 * on number of documents to score is not too large.
17 * @param spec the {@link ScorerSpec} to check
18 * @return the checked spec
19 * @throws IllegalArgumentException if the spec is invalid
21 public static SortSpec
checkValid(SortSpec spec
) {
22 Preconditions
.checkArgument(
23 (!spec
.hasDefaultValueText() || !spec
.hasDefaultValueNumeric()),
24 "at most one of default string or numeric value can be specified");
25 if (spec
.hasDefaultValueText()) {
26 FieldChecker
.checkText(spec
.getDefaultValueText());