static Class type(final String type) {
            if (type == null)
                return null;

            switch (type) {
                case "Vertex":
                    return Vertex.class;
                case "Edge":
                    return Edge.class;
                case "VertexProperty":
                    return VertexProperty.class;
                default: throw new IllegalArgumentException("Type must be one of Vertex/Edge/VertexProperty: " + type);
            }
        }
Specify the type of Element to search for (optional)
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/services/TinkerTextSearchFactory.java