José Santos Thank you very much for you report. We will try to address this in 6.0, or maybe 6.1 considering the amount of work already planned for 6.0. You (or anyone else, of course) may be interested in contributing this feature to Hibernate Search to make it happen sooner. I am not sure you are, but just in case, I will add some insights below. The place to start would currently be the Hibernate Seardch 6 proof-of-concept, which we will ultimately be merging into the main repository: https://github.com/hibernate/hibernate-search-6-poc Be warned, implementing this feature will be quite complex, in particular on the Lucene side. It would be wiser to start implementing it for Elasticsearch only, and only when it works start having a look at the Lucene integration: the Elasticsearch integration is mainly about delegating to Elasticsearch, which is much easier. You will need to:
- Add one or several interfaces specific to Hibernate Search to represent "shapes", similar to org.hibernate.search.v6poc.spatial.GeoPolygon/org.hibernate.search.v6poc.spatial.ImmutableGeoPolygon
- Add one or several "shape" types to the field definition DSL, i.e. add one or several addXXX() methods to
org.hibernate.search.v6poc.backend.document.model.dsl.IndexSchemaFieldContext
- Add implementations for the methods you just added, both for the Lucene backend (org.hibernate.search.v6poc.backend.lucene.document.model.dsl.impl.LuceneIndexSchemaFieldContextImpl, as said above you'd better start with a stub there) and the Elasticsearch backend (org.hibernate.search.v6poc.backend.elasticsearch.document.model.dsl.impl.ElasticsearchIndexSchemaFieldContextImpl).
- Add implementations for the "model" of a "shape" field. The easiest way to do that would be to have a look at the org.hibernate.search.v6poc.backend.elasticsearch.types package, copy/paste everything with GeoPoint in its name and adapt it to your needs.
- Add an integration test. As a first step, you could add something to org.hibernate.search.v6poc.integrationtest.backend.elasticsearch.ExtensionIT, where you have an example of defining a field in the constructor of org.hibernate.search.v6poc.integrationtest.backend.elasticsearch.ExtensionIT.IndexAccessors, examples of populating the index in org.hibernate.search.v6poc.integrationtest.backend.elasticsearch.ExtensionIT#initData, and an example of running a native Elasticsearch query in org.hibernate.search.v6poc.integrationtest.backend.elasticsearch.ExtensionIT#predicate_fromJsonString.
- Then we can talk about adding something to the DSL, and about doing the same for Lucene, but that can definitely be a second step.
An external contributor will very likely need help; we (the Hibernate Search maintainers) are available on our chat platform, HipChat, at this address: https://www.hipchat.com/gYdEKgkOi There is some information about generating the technical documentation in the README; this documentation should help understanding the general architecture should you be interested, but is not very useful in this specific cases: it's more about the higher-level aspects of entity mapping than the lower-level aspects of field types and index management. |