use of com.google.appengine.api.datastore.CompositeIndexManager.IndexComponentsOnlyQuery in project appengine-java-standard by GoogleCloudPlatform.
the class AdminDatastoreService method minimumCompositeIndexesForQuery.
public Set<Index> minimumCompositeIndexesForQuery(Query query, Collection<Index> indexes) {
List<DatastoreV3Pb.Query> pbQueries = convertQueryToPbs(query, FetchOptions.Builder.withDefaults());
List<OnestoreEntity.Index> indexPbs = Lists.newArrayListWithCapacity(indexes.size());
for (Index index : indexes) {
indexPbs.add(IndexTranslator.convertToPb(index));
}
Set<Index> resultSet = new HashSet<Index>();
for (DatastoreV3Pb.Query queryProto : pbQueries) {
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);
OnestoreEntity.Index index = factory.getCompositeIndexManager().minimumCompositeIndexForQuery(indexQuery, indexPbs);
if (index != null) {
resultSet.add(IndexTranslator.convertFromPb(index));
}
}
return resultSet;
}
use of com.google.appengine.api.datastore.CompositeIndexManager.IndexComponentsOnlyQuery in project appengine-java-standard by GoogleCloudPlatform.
the class AdminDatastoreService method compositeIndexesForQuery.
public Set<Index> compositeIndexesForQuery(Query query) {
List<DatastoreV3Pb.Query> pbQueries = convertQueryToPbs(query, FetchOptions.Builder.withDefaults());
Set<Index> resultSet = new HashSet<Index>();
for (DatastoreV3Pb.Query queryProto : pbQueries) {
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);
OnestoreEntity.Index index = factory.getCompositeIndexManager().compositeIndexForQuery(indexQuery);
if (index != null) {
resultSet.add(IndexTranslator.convertFromPb(index));
}
}
return resultSet;
}
use of com.google.appengine.api.datastore.CompositeIndexManager.IndexComponentsOnlyQuery in project appengine-java-standard by GoogleCloudPlatform.
the class QueryRunnerV3 method addMissingIndexData.
private void addMissingIndexData(DatastoreV3Pb.Query queryProto, DatastoreNeedIndexException e) {
IndexComponentsOnlyQuery indexQuery = new IndexComponentsOnlyQuery(queryProto);
CompositeIndexManager mgr = new CompositeIndexManager();
OnestoreEntity.Index index = mgr.compositeIndexForQuery(indexQuery);
if (index != null) {
String xml = mgr.generateXmlForIndex(index, IndexSource.manual);
e.setMissingIndexDefinitionXml(xml);
} else {
// Prod says we need an index but the index manager says we don't.
// Probably a bug in the index manager. DatastoreNeedIndexException
// will report this in the exception message.
}
}
Aggregations