Skip to content

PatternTextCompositeValues refactoring#140939

Merged
martijnvg merged 4 commits intoelastic:mainfrom
martijnvg:PatternTextFallbackDocValues
Jan 26, 2026
Merged

PatternTextCompositeValues refactoring#140939
martijnvg merged 4 commits intoelastic:mainfrom
martijnvg:PatternTextFallbackDocValues

Conversation

@martijnvg
Copy link
Copy Markdown
Member

  • Renamed PatternTextFallbackDocValues to PatternTextFallbackDocValues.
  • Made PatternTextFallbackDocValues an abstract class
  • Added two subclasses for the case when the fallback values are stored as stored fields and for when fallback values are stored as binary doc values.

* Renamed PatternTextFallbackDocValues to PatternTextFallbackDocValues.
* Made PatternTextFallbackDocValues an abstract class
* Added two subclasses for the case when the fallback values are stored as stored fields and for when fallback values are stored as binary doc values.
@martijnvg martijnvg added >refactoring :StorageEngine/Mapping The storage related side of mappings labels Jan 20, 2026
@martijnvg martijnvg marked this pull request as ready for review January 20, 2026 08:00
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Copy Markdown
Contributor

@Kubik42 Kubik42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some minor comments.

return null;
}

var docValues = PatternTextDocValues.from(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I don't agree with the naming of this class. PatternTextFallbackDocValues implies the values are for fallback, but in this case, if there is no fallback, then we return PatternTextDocValues. Can we merge this from() method with the one in PatternTextDocValues?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In advanceExact(), we first check whether patternTextDocValues has a value and if not we check either binary doc values or stored fields. So it can be seen as a fallback?

Can we merge this from() method with the one in PatternTextDocValues?

Yes, that makes sense.

FieldInfo fieldInfo = leafReader.getFieldInfos().fieldInfo(fieldType.storedNamed());
if (fieldInfo == null) {
// If there is no stored subfield (either binary doc values or stored field),
// then there is no need to use PatternTextCompositeValues
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment still mentions PatternTextCompositeValues although that class no longer exists

@martijnvg martijnvg enabled auto-merge (squash) January 26, 2026 12:56
@martijnvg martijnvg merged commit 5fc11b1 into elastic:main Jan 26, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants