Open spring-projects-issues opened 7 years ago
Jordi Llach Fernandez commented
By the way with the current behaviour when a new field is added to the nested entity an exception is thrown because text index's definition has changed from the previous one
Jordi Llach Fernandez opened DATAMONGO-1561 and commented
Given an entity A that contains a
@TextIndexed
field whom in turn is another entity(B).MongoPersistentEntityIndexResolver
's methodappendTextIndexInformation
changes theIncludeStrategy
fromDEFAULT
toFORCE
and thus cause that ALL the fields of the nested document B to become part of the text index, no matter if this nested document contains a set of selected fields marked as@TextIndexed
or not.I was expecting that only selected fields of entity B will become part of the text index.
I could make a PR that will enable this behaviour with two steps:
BasicMongoPersistentEntity
will verify that entities marked with@ContainsTextIndexedFields
effectively have at least one field marked with@TextIndexed
otherwise aMappingException
will be thrownMongoPersistentEntityIndexResolver.appendTextIndexInformation
will not change the include strategy for a nested entity when this is marked with@ContainsTextIndexedFields
What do you think ? makes sense ?
Reference URL: https://jira.spring.io/browse/DATAMONGO-937
Referenced from: pull request https://github.com/spring-projects/spring-data-mongodb/pull/442
1 votes, 1 watchers