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

Search 6 groundwork - Invert the syntax of accessors

Description

Use a more intuitive syntax, where methods are called on the document element being modified instead of the accessors.

The discussion originated from a concern that the syntax borrowalsObjectFieldAccessor.add( target ) was not very clear, especially not to new users. A few solutions were mentioned, one of which was renaming add() to addTo or create, and another was to invert the syntax of accessors, which may feel more "natural".

See https://github.com/hibernate/hibernate-search-6-poc/commit/f07d3c2a5278c8c1baaa32ef803e57d4d6653b79:

This:

1 2 DocumentElement borrowalsObject = borrowalsObjectFieldAccessor.add( target ); shortTermBorrowalCountAccessor.write( borrowalsObject, shortTermBorrowalCount );

Would become this:

1 2 DocumentElement borrowalsObject = target.addNew( borrowalsObjectFieldReference ); borrowalsObject.add( shortTermBorrowalCountReference, shortTermBorrowalCount );

We may want to do the same for entity accessors, to be consistent.

Note that in order for this to make sense, we would have to rename the "accessor" to a "reference" or some similar term expressing the fact that this object is "passive" by nature (on contrary to an "accessor").

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major