spring-projects / spring-data-mongodb

Provides support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-mongodb/
Apache License 2.0
1.62k stars 1.09k forks source link

Improve text index creation when dealing with nested entities/documents [DATAMONGO-1561] #2477

Open spring-projects-issues opened 7 years ago

spring-projects-issues commented 7 years ago

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 method appendTextIndexInformation changes the IncludeStrategy from DEFAULT to FORCE 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:

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

spring-projects-issues commented 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