spring-projects / spring-projects/spring-data-mongodb

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

Open
#2,477 1 comment 0 reactions 1 assignee View on GitHub

@christophstrobl is already working on this.

Since Dec 30, 2020.

in: core type: enhancement
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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:

  • BasicMongoPersistentEntity will verify that entities marked with @ContainsTextIndexedFields effectively have at least one field marked with @TextIndexed otherwise a MappingException will be thrown

  • MongoPersistentEntityIndexResolver.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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.