diff --git a/docs/reference/document_mapper.rst b/docs/reference/document_mapper.rst new file mode 100644 index 00000000..9883bd53 --- /dev/null +++ b/docs/reference/document_mapper.rst @@ -0,0 +1,32 @@ +DocumentFactory +=============== +DocumentFactory is an implementation of field mappers for Elasticsearch modeled after the Solr implementation using the +template method pattern. It implements the Elasticsearch ``DocumentFactoryInterface`` and its methods ``fromContent()`` +and ``fromLocation()`` add fields to document. These methods index the fields from the suitable field mappers. + +``DocumentFactory`` depends on the elasticsearch service ``DocumentFactoryInterface`` , so it is registered in a +Compiler Pass since elasticsearch is not available directly from the bundle. + +To use this feature, ensure you have elasticsearch bundle added to your project. + +The ``DocumentFactory`` service uses all base field mapper services to index content into the correct document +(content, location, or translation-dependent document):: + + ContentFieldMapper + LocationFieldMapper + ContentTranslationFieldMapper + LocationTranslationFieldMapper + BlockFieldMapper + BlockTranslationFieldMapper + +These services are abstract classes containing methods ``accept()`` and ``mapFields()`` which are implemented by new +field mappers as needed. + +To add a new field mapper, create a class that extends one of the base field mappers above, implements its methods, and +registers the service with one of the following tags, depending on the base field mapper:: + + netgen.ibexa_search_extra.elasticsearch.field_mapper.content + netgen.ibexa_search_extra.elasticsearch.field_mapper.location + netgen.ibexa_search_extra.elasticsearch.field_mapper.content_translation + netgen.ibexa_search_extra.elasticsearch.field_mapper.location_translation + netgen.ibexa_search_extra.elasticsearch.field_mapper.block_translation diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 996318ee..95856d7b 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -9,5 +9,7 @@ Reference subdocuments spellcheck_suggestions extra_fields + asynchronous_indexing + document_mapper .. include:: /reference/map.rst.inc diff --git a/docs/reference/map.rst.inc b/docs/reference/map.rst.inc index 626ee8e9..bdeafe91 100644 --- a/docs/reference/map.rst.inc +++ b/docs/reference/map.rst.inc @@ -4,3 +4,4 @@ * :doc:`/reference/subdocuments` * :doc:`/reference/spellcheck_suggestions` * :doc:`/reference/extra_fields` +* :doc:`/reference/document_mapper`