1 package com
.google
.appengine
.api
.search
.checkers
;
3 import static com
.google
.appengine
.api
.search
.checkers
.DocumentChecker
.mandatoryCheckValid
;
5 import com
.google
.apphosting
.api
.search
.DocumentPb
;
6 import com
.google
.common
.base
.Strings
;
9 * This class performs {@link DocumentPb.Document} validity checks for search customers that only
12 public class QueryOnlyCustomerDocumentChecker
{
15 * Checks whether a {@link DocumentPb.Document} has a valid set of fields for clients that only
16 * use the search query API.
18 * @param pb the {@link DocumentPb.Document} protocol buffer to check.
19 * @throws IllegalArgumentException if the document is invalid.
21 public static void checkValid(DocumentPb
.Document pb
) {
22 Preconditions
.checkArgument(pb
.hasId(), "Document id is not specified");
23 Preconditions
.checkArgument(!Strings
.isNullOrEmpty(pb
.getId()), "Document id is null or empty");
24 mandatoryCheckValid(pb
);