We're updating the issue view to help you get more done. 

Search 6 groundwork - Split the field definition API in two: encoding definition and field definition

Description

Having a dedicated API to define index field types, or encodings, regardless of when and where that encoding is used, could help in several ways:

  • Dynamic field APIs could re-use this encoding definition API, or require an encoding to be passed when defining a dynamic field; see

  • We could make ValueBridge#bind cleaner by passing it interfaces from the encoding definition API instead of the field definition API (i.e. the ValueBridge would no longer be able to create an accessor)

Below is a concrete example; instead of having this:

1 2 3 4 5 6 7 @Override public void bind(IndexSchemaElement indexSchemaElement, PojoModelProperty bridgedPojoModelProperty, SearchModel searchModel) { this.textFieldAccessor = indexSchemaElement .field( "fieldName" ).asString().createAccessor(); }

… we would probably have something like this:

1 2 3 4 5 6 7 8 9 @Override public void bind(IndexModel indexModel, IndexSchemaElement indexSchemaElement, PojoModelProperty bridgedPojoModelProperty, SearchModel searchModel) { this.textFieldAccessor = indexSchemaElement.field( "fieldName" ) .encoding( indexModel.encoding().asString() ) .createAccessor(); }

Then when dynamic fields get introduced (HSEARCH-3273), we can also reuse the encoding definition API, i.e.:

1 2 3 4 5 6 7 8 9 @Override public void bind(IndexModel indexModel, IndexSchemaElement indexSchemaElement, PojoModelProperty bridgedPojoModelProperty, SearchModel searchModel) { this.dynamicTextFieldAccessor = indexSchemaElement.dynamicField().encoding( indexModel.encoding().asString() ) // This would return a different type of accessor requiring a field name .createAccessor();

Related: HSEARCH-3217. Maybe it should be closed as obsolete, maybe it is still relevant for the encoding definition API.

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major