Skip to content

Autoindexing fails if index field name contains '.' #1166

Closed
@vals-productions

Description

@vals-productions
@Document
@CompositeQueryIndex(name="AnotherEntity_idx", fields = {"anotherEntity.id"})
public class DatabaseEntity  {

private AnotherEntity anotherEntity;
....
}

Index generation will fail with the error:

Could not auto-create index with statement: CREATE INDEX idx_databasentity_anotherentity.id ON .....

note period '.' in index name. Apparently couchbase does not like it.

It probably could either replace '.' with '_' and/or, use index name provided in the annotation?

I can create the index manually through couchbase admin webapp if index name was acceptable.

The code is in CouchbasePersistentEntityIndexResolver createCompositeQueryIndexDefinitions method. As you cen see it appends field name and does not consider annotation index name.

line 133: String indexName = "idx_" + StringUtils.uncapitalize(entity.getType().getSimpleName()) + "_" + fieldsIndexName;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions