Skip to content

Commit

Permalink
NGSTACK-843 fix documentation formating
Browse files Browse the repository at this point in the history
  • Loading branch information
Katarina Miočić committed Sep 10, 2024
1 parent 3e8626b commit fb6f609
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ Reference
subdocuments
spellcheck_suggestions
extra_fields
asynchronous_indexing
page_indexing

.. include:: /reference/map.rst.inc
1 change: 1 addition & 0 deletions docs/reference/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* :doc:`/reference/subdocuments`
* :doc:`/reference/spellcheck_suggestions`
* :doc:`/reference/extra_fields`
* :doc:`/reference/page_indexing`
26 changes: 14 additions & 12 deletions docs/reference/page_indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -85,39 +86,40 @@ 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
netgen.ibexa_search_extra.elasticsearch.field_mapper.location_translation
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
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.

0 comments on commit fb6f609

Please sign in to comment.