I took the flight home to play with free form and specifically how we would retrieve data
from the free form structure.
By free-form I mean non POJO but they will have schema (not expressed here).
https://github.com/emmanuelbernard/hibernate-search/commit/0bd3fbab137bda...
And in particular
https://github.com/emmanuelbernard/hibernate-search/blob/freeform/freefor...
https://github.com/emmanuelbernard/hibernate-search/blob/freeform/freefor...
It probably does not compile, I could not make the build work.
I figured it was important to dump this raw thinking because it will influence and will be
influenced by the redesign of the DocumentBuilder of Hibernate Search.
There are several options for traversing a free form structure
- expose the traversing API as a holder to navigate all properties per structure and sub
structure. This is what the prototype shows. Caching needs to be accessed via a hashmap
get or other lookup. Metadata and the traversing structure will be navigated in parallel
- expose a structure that is specialized to a single property or container unwrapping
aspect. The structures will be spread across and embedded in the Metadata
Another angle:
- create a traversable object per payload to carry it (sharing metadata info per type)
- have a stateless traversable object that is provided the payload for each access
The former seems better as it does not create a traversable object per object navigated.
The latter is better for payloads that need parsing or are better at sequential access
since state could be cached.
We need to discuss that and know where DocumentBuilder is going to properly design this
API.
Emmanuel