spring-projects / spring-projects/spring-data-couchbase
CompositeQueryIndex annotation on class is added multiple. times [DATACOUCH-618]
Open
@mikereiche is already working on this.
Since Dec 31, 2020.
type: enhancement
- Dominant language
- Java
- Stars
- 284
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Michael Reiche opened DATACOUCH-618 and commented
This doesn't seem to break anything, but it seems unnecessary.
public List<IndexDefinitionHolder> resolveIndexForEntity(final CouchbasePersistentEntity<?> root) {
Assert.notNull(root, "CouchbasePersistentEntity must not be null!");
Document document = root.findAnnotation(Document.class);
Assert.notNull(document, () -> String
.format("Entity %s is not a collection root. Make sure to annotate it with @Document!", root.getName()));
List<IndexDefinitionHolder> indexInformation = new ArrayList<>();
>>>>> potentiallyAddIndexForProperty is called for every property <<<<<
root.doWithProperties((PropertyHandler<CouchbasePersistentProperty>) property -> this
.potentiallyAddIndexForProperty(root, property, indexInformation));
return indexInformation;
}
private void potentiallyAddIndexForProperty(final CouchbasePersistentEntity<?> root,
final CouchbasePersistentProperty persistentProperty, final List<IndexDefinitionHolder> indexes) {
>>>>> createIndexDefinitionHolderForProperty has CompositeQueryIndex <<<<<
List<IndexDefinitionHolder> indexDefinitions = createIndexDefinitionHolderForProperty(
persistentProperty.getFieldName(), root, persistentProperty);
if (!indexDefinitions.isEmpty()) {
indexes.addAll(indexDefinitions);
}
}
private List<IndexDefinitionHolder> createIndexDefinitionHolderForProperty(final String dotPath,
final CouchbasePersistentEntity<?> persistentEntity, final CouchbasePersistentProperty persistentProperty) {
List<IndexDefinitionHolder> indices = new ArrayList<>();
if (persistentProperty.isAnnotationPresent(QueryIndexed.class)) {
indices.add(createFieldQueryIndexDefinition(persistentEntity, persistentProperty));
}
>>>>>>>> composite index added here <<<<<
if (persistentEntity.isAnnotationPresent(CompositeQueryIndex.class)
|| persistentEntity.isAnnotationPresent(CompositeQueryIndexes.class)) {
indices.addAll(createCompositeQueryIndexDefinitions(persistentEntity, persistentProperty));
}
No further details from DATACOUCH-618
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.