Skip to content

Commit 41ee67a

Browse files
committed
fix merge errors
1 parent 40ff860 commit 41ee67a

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/main/java/com/arangodb/springframework/core/template/ArangoTemplate.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,26 @@ private static void ensureTtlIndex(final CollectionOperations collection, final
262262
}
263263

264264
private static void ensureMDIndex(final CollectionOperations collection, final MDIndex annotation, Collection<IndexEntity> existing) {
265-
collection.ensureMDIndex(Arrays.asList(annotation.fields()),
266-
new MDIndexOptions()
267-
.unique(annotation.unique())
268-
.fieldValueTypes(annotation.fieldValueTypes())
269-
.sparse(annotation.sparse())
270-
);
265+
final MDIndexOptions options = new MDIndexOptions()
266+
.unique(annotation.unique())
267+
.fieldValueTypes(annotation.fieldValueTypes())
268+
.sparse(annotation.sparse());
269+
Collection<String> fields = Arrays.asList(annotation.fields());
270+
if (createNewIndex(IndexType.mdi, fields, existing)) {
271+
existing.add(collection.ensureMDIndex(fields, options));
272+
}
271273
}
272274

273275
private static void ensureMDPrefixedIndex(final CollectionOperations collection, final MDPrefixedIndex annotation, Collection<IndexEntity> existing) {
274-
collection.ensureMDPrefixedIndex(Arrays.asList(annotation.fields()),
275-
new MDPrefixedIndexOptions()
276-
.prefixFields(Arrays.asList(annotation.prefixFields()))
277-
.unique(annotation.unique())
278-
.fieldValueTypes(annotation.fieldValueTypes())
279-
.sparse(annotation.sparse())
280-
);
276+
final MDPrefixedIndexOptions options = new MDPrefixedIndexOptions()
277+
.prefixFields(Arrays.asList(annotation.prefixFields()))
278+
.unique(annotation.unique())
279+
.fieldValueTypes(annotation.fieldValueTypes())
280+
.sparse(annotation.sparse());
281+
Collection<String> fields = Arrays.asList(annotation.fields());
282+
if (createNewIndex(IndexType.mdiPrefixed, fields, existing)) {
283+
existing.add(collection.ensureMDPrefixedIndex(fields, options));
284+
}
281285
}
282286

283287
private static boolean createNewIndex(IndexType type, Collection<String> fields, Collection<IndexEntity> existing) {
@@ -574,7 +578,7 @@ public <T> T repsert(final T value, AqlQueryOptions options) throws DataAccessEx
574578
bindVars,
575579
options, clazz
576580
);
577-
result = it.hasNext() ? it.next() : null;
581+
result = it.next();
578582
} catch (final ArangoDBException e) {
579583
throw translateException(e);
580584
}

0 commit comments

Comments
 (0)