use of org.springframework.data.mongodb.core.index.Index in project ocvn by devgateway.
the class MongoTemplateConfiguration method createMandatoryImportIndexes.
public void createMandatoryImportIndexes() {
// vietnam specific indexes
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.budget.projectID", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.bidNo", Direction.ASC));
mongoTemplate.indexOps(Organization.class).ensureIndex(new Index().on("identifier._id", Direction.ASC));
mongoTemplate.indexOps(Organization.class).ensureIndex(new Index().on("additionalIdentifiers._id", Direction.ASC));
mongoTemplate.indexOps(Organization.class).ensureIndex(new Index().on("roles", Direction.ASC));
mongoTemplate.indexOps(Organization.class).ensureIndex(new Index().on("name", Direction.ASC).unique());
mongoTemplate.indexOps(VNLocation.class).ensureIndex(new Index().on("description", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.contrMethod.details", Direction.ASC));
logger.info("Added mandatory Mongo indexes");
}
use of org.springframework.data.mongodb.core.index.Index in project ocvn by devgateway.
the class MongoTemplateConfiguration method createPostImportStructures.
public void createPostImportStructures() {
createCorruptionFlagsIndexes();
// initialize some extra indexes
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("ocid", Direction.ASC).unique());
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.procurementMethod", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.procurementMethodRationale", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.status", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("awards.status", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("awards.suppliers._id", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("awards.date", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("awards.publishedDate", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("awards.value.amount", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.value.amount", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.contrMethod._id", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.numberOfTenderers", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.cancellationRationale", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.submissionMethod", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.publicationMethod", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE, Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on(MongoConstants.FieldNames.TENDER_PERIOD_END_DATE, Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.items.classification._id", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.items.deliveryLocation._id", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.items.deliveryLocation.geometry.coordinates", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.budget.projectLocation.geometry.coordinates", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.budget.projectLocation._id", Direction.ASC));
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("tender.items.deliveryLocation.geometry.coordinates", Direction.ASC));
mongoTemplate.indexOps(Organization.class).ensureIndex(new TextIndexDefinitionBuilder().onField("name").onField("id").onField("additionalIdentifiers._id").build());
mongoTemplate.indexOps(VNLocation.class).ensureIndex(new TextIndexDefinitionBuilder().onField("description").onField("uri").build());
//vietnam specific indexes:
mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.bidPlanProjectDateApprove", Direction.ASC));
createProcuringEntityIndexes();
logger.info("Added extra Mongo indexes");
ScriptOperations scriptOps = mongoTemplate.scriptOps();
// add script to calculate the percentiles endpoint
URL scriptFile = getClass().getResource("/tenderBidPeriodPercentilesMongo.js");
try {
String scriptText = IOUtils.toString(scriptFile);
ExecutableMongoScript script = new ExecutableMongoScript(scriptText);
scriptOps.register(new NamedMongoScript("tenderBidPeriodPercentiles", script));
} catch (IOException e) {
e.printStackTrace();
}
// add general mongo system helper methods
URL systemScriptFile = getClass().getResource("/mongoSystemScripts.js");
try {
String systemScriptFileText = IOUtils.toString(systemScriptFile);
ExecutableMongoScript script = new ExecutableMongoScript(systemScriptFileText);
scriptOps.execute(script);
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.springframework.data.mongodb.core.index.Index in project oc-explorer by devgateway.
the class AbstractMongoDatabaseConfiguration method createMandatoryImportIndexes.
public void createMandatoryImportIndexes() {
// mongoTemplate.indexOps(Release.class).ensureIndex(new Index().on("planning.budget.projectID", Direction.ASC));
// mongoTemplate.indexOps(Location.class).ensureIndex(new Index().on("description", Direction.ASC));
getTemplate().indexOps(Organization.class).ensureIndex(new Index().on("identifier._id", Direction.ASC));
getTemplate().indexOps(Organization.class).ensureIndex(new Index().on("additionalIdentifiers._id", Direction.ASC));
getTemplate().indexOps(Organization.class).ensureIndex(new Index().on("roles", Direction.ASC));
getTemplate().indexOps(Organization.class).ensureIndex(new Index().on("name", Direction.ASC).unique());
getTemplate().indexOps(DefaultLocation.class).ensureIndex(new Index().on("description", Direction.ASC));
getLogger().info("Added mandatory Mongo indexes");
}
use of org.springframework.data.mongodb.core.index.Index in project spring-data-mongodb by spring-projects.
the class DefaultIndexOperationsIntegrationTests method shouldApplyPartialFilterWithMappedPropertyCorrectly.
// DATAMONGO-1467
@Test
public void shouldApplyPartialFilterWithMappedPropertyCorrectly() {
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
IndexDefinition id = new Index().named("partial-with-mapped-criteria").on("k3y", Direction.ASC).partial(of(where("quantity").gte(10)));
indexOps.ensureIndex(id);
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-mapped-criteria");
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"qty\" : { \"$gte\" : 10 } }");
}
use of org.springframework.data.mongodb.core.index.Index in project spring-data-mongodb by spring-projects.
the class DefaultIndexOperationsIntegrationTests method shouldApplyPartialFilterCorrectly.
// DATAMONGO-1467
@Test
public void shouldApplyPartialFilterCorrectly() {
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
IndexDefinition id = new Index().named("partial-with-criteria").on("k3y", Direction.ASC).partial(of(where("q-t-y").gte(10)));
indexOps.ensureIndex(id);
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-criteria");
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"q-t-y\" : { \"$gte\" : 10 } }");
}
Aggregations