com.google.appengine.api.search
Class Schema
- java.lang.Object
-
- com.google.appengine.api.search.Schema
-
public final class Schema extends java.lang.ObjectContains information about the kinds of documentFieldswhich are supported by theIndex.// 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 classSchema.BuilderA builder which constructs Schema objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)java.util.Set<java.lang.String>getFieldNames()java.util.List<Field.FieldType>getFieldTypes(java.lang.String fieldName)inthashCode()static Schema.BuildernewBuilder()Creates a schema builder.java.lang.StringtoString()
-
-
-
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.FieldTypesupported 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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
newBuilder
public static Schema.Builder newBuilder()
Creates a schema builder.- Returns:
- a new builder for creating a schema
-
-