Java 8 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Java 8
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Java
8 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Java.
Schema (Google App Engine API for Java)
Stay organized with collections
Save and categorize content based on your preferences.
- java.lang.Object
-
- com.google.appengine.api.search.Schema
-
public final class Schema
extends java.lang.Object
Contains information about the kinds of document
Fields
which are supported by the
Index
.
// Get the searchService for the default namespace
SearchService searchService = SearchServiceFactory.getSearchService();
// Get the first page of indexes available and retrieve schemas
GetResponse<Index> response = searchService.getIndexes(
GetIndexesRequest.newBuilder().setSchemaFetched(true).build());
// List out elements of Schema
for (Index index : response) {
Schema schema = index.getSchema();
for (String fieldName : schema.getFieldNames()) {
List<FieldType> typesForField = schema.getFieldTypes(fieldName);
}
}
-
-
Nested Class Summary
Nested Classes
Modifier and Type |
Class and Description |
static class |
Schema.Builder
A builder which constructs Schema objects.
|
-
Method Summary
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
-
Method Detail
-
getFieldNames
public java.util.Set<java.lang.String> getFieldNames()
- Returns:
- the set of field names supported in the schema
-
getFieldTypes
public java.util.List<Field.FieldType> getFieldTypes(java.lang.String fieldName)
- Parameters:
fieldName
- the name of the field to return supported types
- Returns:
- a list of
Field.FieldType
supported for the given field
name. The returned list will be empty if the schema has no field with the given name.
-
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSchema\u003c/code\u003e class contains information about the types of \u003ccode\u003eFields\u003c/code\u003e supported by an \u003ccode\u003eIndex\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a list of field names within a schema using the \u003ccode\u003egetFieldNames()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetFieldTypes(String fieldName)\u003c/code\u003e method provides a list of \u003ccode\u003eField.FieldType\u003c/code\u003e supported for a specified field name.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eSchema.Builder\u003c/code\u003e can be created using the \u003ccode\u003enewBuilder()\u003c/code\u003e method for constructing \u003ccode\u003eSchema\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides the ability to check equality and hash code using the methods \u003ccode\u003eequals()\u003c/code\u003e and \u003ccode\u003ehashCode()\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Schema (Google App Engine API for Java)\n\ncom.google.appengine.api.search\n\nClass Schema\n------------\n\n- java.lang.Object\n-\n - com.google.appengine.api.search.Schema\n\n-\n\n *** ** * ** ***\n\n \u003cbr /\u003e\n\n ```\n public final class Schema\n extends java.lang.Object\n ``` \n Contains information about the kinds of document [`Fields`](../../../../../com/google/appengine/api/search/Field.html \"class in com.google.appengine.api.search\") which are supported by the [`Index`](../../../../../com/google/appengine/api/search/Index.html \"interface in com.google.appengine.api.search\").\n\n\n\n // Get the searchService for the default namespace\n SearchService searchService = SearchServiceFactory.getSearchService();\n\n // Get the first page of indexes available and retrieve schemas\n GetResponse\u003cIndex\u003e response = searchService.getIndexes(\n GetIndexesRequest.newBuilder().setSchemaFetched(true).build());\n\n // List out elements of Schema\n for (Index index : response) {\n Schema schema = index.getSchema();\n for (String fieldName : schema.getFieldNames()) {\n List\u003cFieldType\u003e typesForField = schema.getFieldTypes(fieldName);\n }\n }\n \n \u003cbr /\u003e\n\n-\n -\n\n ### Nested Class Summary\n\n \u003c!-- --\u003e\n\n -\n\n ### Method Summary\n\n -\n\n ### Methods inherited from class java.lang.Object\n\n`getClass, notify, notifyAll, wait, wait, wait` \n-\n -\n\n ### Method Detail\n\n\n -\n\n #### getFieldNames\n\n ```\n public java.util.Set\u003cjava.lang.String\u003e getFieldNames()\n ```\n\n Returns:\n : the set of field names supported in the schema\n\n\n -\n\n #### getFieldTypes\n\n ```\n public java.util.List\u003cField.FieldType\u003e getFieldTypes(java.lang.String fieldName)\n ```\n\n Parameters:\n : `fieldName` - the name of the field to return supported types\n\n Returns:\n : a list of [`Field.FieldType`](../../../../../com/google/appengine/api/search/Field.FieldType.html \"enum in com.google.appengine.api.search\") supported for the given field\n name. The returned list will be empty if the schema has no field with the given name.\n\n\n -\n\n #### toString\n\n ```\n public java.lang.String toString()\n ```\n\n Overrides:\n : `toString` in class `java.lang.Object`\n\n\n -\n\n #### hashCode\n\n ```\n public int hashCode()\n ```\n\n Overrides:\n : `hashCode` in class `java.lang.Object`\n\n\n -\n\n #### equals\n\n ```\n public boolean equals(java.lang.Object obj)\n ```\n\n Overrides:\n : `equals` in class `java.lang.Object`\n\n\n -\n\n #### newBuilder\n\n ```\n public static Schema.Builder newBuilder()\n ``` \n Creates a schema builder.\n\n Returns:\n : a new builder for creating a schema"]]