Class DocumentChecker


  • public final class DocumentChecker
    extends Object
    Checks values of a Document.
    • Constructor Detail

      • DocumentChecker

        public DocumentChecker()
    • Method Detail

      • checkDocumentId

        public static String checkDocumentId​(String documentId)
        Checks whether a document id is valid. A document id is a non-null ASCII visible printable string of #MAXIMUM_DOCUMENT_ID_LENGTH characters which does not start with '!' which is reserved for system documents.
        Parameters:
        documentId - the document id to check
        Returns:
        the checked document id
        Throws:
        IllegalArgumentException - if the document id is invalid
      • checkFieldSet

        public static void checkFieldSet​(com.google.apphosting.api.search.DocumentPb.Document document)
        Checks whether a document's field set is valid. A field set is valid if it does not contain any number, date, or vector fields with the same name.
        Parameters:
        document - the document to check
        Throws:
        IllegalArgumentException - if the document contains an invalid set of fields.
      • checkFacetSet

        public static void checkFacetSet​(com.google.apphosting.api.search.DocumentPb.Document document)
        Checks validity of facets in document.
      • checkValid

        public static com.google.apphosting.api.search.DocumentPb.Document checkValid​(com.google.apphosting.api.search.DocumentPb.Document pb)
        Checks whether a DocumentPb.Document has a valid set of fields.
        Parameters:
        pb - the DocumentPb.Document protocol buffer to check
        Returns:
        the checked document
        Throws:
        IllegalArgumentException - if some field is invalid such as document id or fields
      • getNumberOfSecondsSince

        public static int getNumberOfSecondsSince()
        Returns:
        the number of seconds since 2011/1/1