From fb6f609b2fd23b1cad166559685ab45f12219e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Tue, 10 Sep 2024 10:12:59 +0200 Subject: [PATCH] NGSTACK-843 fix documentation formating --- docs/reference/index.rst | 2 ++ docs/reference/map.rst.inc | 1 + docs/reference/page_indexing.rst | 26 ++++++++++++++------------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 996318ee..c14b0b77 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -9,5 +9,7 @@ Reference subdocuments spellcheck_suggestions extra_fields + asynchronous_indexing + page_indexing .. include:: /reference/map.rst.inc diff --git a/docs/reference/map.rst.inc b/docs/reference/map.rst.inc index 626ee8e9..fb270269 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/page_indexing` diff --git a/docs/reference/page_indexing.rst b/docs/reference/page_indexing.rst index 2888b86b..8c18751c 100644 --- a/docs/reference/page_indexing.rst +++ b/docs/reference/page_indexing.rst @@ -3,7 +3,8 @@ Page indexing This feature allows indexing of content by scraping the page using Symfony's HTTP client and indexing its content into document fields. -''Config'' +Configuration +------------- To enable this feature, set up the page indexing configuration: .. code-block:: yaml @@ -65,15 +66,15 @@ following the HTML tag with a class name as shown in the example. ``host`` Define this parameter in the .env file. It's used by the Symfony HTTP client to resolve the page URL. -''DocumentFactory'' +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. The ``DocumentFactory`` service uses all base field mapper services to index content into the correct document -(content, location, or translation-dependent document): +(content, location, or translation-dependent document):: -.. code-block:: php ContentFieldMapper LocationFieldMapper ContentTranslationFieldMapper @@ -85,9 +86,8 @@ These services are abstract classes containing methods ``accept()`` and ``mapFie 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: +registers the service with one of the following tags, depending on the base field mapper:: -.. code-block:: yaml 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 @@ -95,7 +95,8 @@ registers the service with one of the following tags, depending on the base fiel netgen.ibexa_search_extra.elasticsearch.field_mapper.block_translation -''PageTextExtractor'' +PageTextExtractor +----------------- The PageTextExtractor is a service that scrapes the page with Symfony's http client. It contains a cache parameter that holds the last 10 indexed contents by language. The entire logic is stored in the ``NativePageTextExtractor``, allowing for new methods of indexing page content to be implemented if needed. This service extends PageTextExtractor so to @@ -103,21 +104,22 @@ implement new logic, extend ``PageTextExtractor`` and implement the new logic. This service also manages the fields configuration explained above. -''Command'' +Command +------- As a part of this feature we have implemented the ``IndexPageContentCommand``. This command is used to perform a complete page index when the feature is new to the project. It goes through all content types specified in the configuration (``allowed_content_types``) and reindexes all existing content of the specified types by their pages. -To start the reindex, use the following command: +To start the reindex, use the following command:: -.. code-block:: command netgen-search-extra:index-page-content -The command also has an option ``content-ids``: -.. code-block:: command +The command also has an option ``content-ids``:: + netgen-search-extra:index-page-content --content-ids=38 + To index multiple content IDs, add them to the command separated by commas.