search_core/Documentation/source/usage.rst
Daniel Siepmann 689f293194
TASK: Finish deletion of index and documents feature
We replace the "flush" and "delete" by "delete" and "deletedocuments"
logic. This makes it more obvious what will happen, without reading the
docs.

Also we kept the logic to always provide the index name, as
we will need them in the future. Due to elasticsearch v6 changes no
types are allowed in the same index in the future. Therefore we need to
make it possible to use different indexes in the future, leading to the
need to provide the document type all the time.
2018-12-30 13:43:43 +01:00

3.8 KiB

Usage

Manual indexing

You can trigger indexing from CLI:

./typo3/cli_dispatch.phpsh extbase index:index --identifiers 'pages'
./bin/typo3cms index:index --identifiers 'pages'

This will index the table pages using the TcaIndexer.

Multiple indexer can be called by providing a comma separated list of identifiers as a single argument. Spaces before and after commas are ignored. The indexers have to be defined in TypoScript via configuration_options_index.

Manual deletion

You can trigger deletion for indexes from CLI:

./typo3/cli_dispatch.phpsh extbase index:delete --identifiers 'pages'
./bin/typo3cms index:delete --identifiers 'pages'

This will delete the index for the table pages. Deletion means removing all documents from the index.

Multiple indexes can be called by providing a comma separated list of identifiers as a single argument. Spaces before and after commas are ignored.

Manual delete all documents

You can trigger deletion of all documents for indexes from CLI:

./typo3/cli_dispatch.phpsh extbase index:deletedocuments --identifiers 'pages'
./bin/typo3cms index:deletedocuments --identifiers 'pages'

This will delete all documents within the index for the table pages.

Multiple indexes can be called by providing a comma separated list of identifiers as a single argument. Spaces before and after commas are ignored.

Auto indexing

Indexing is done through hooks every time an record is changed. The tables have to be configured via configuration_options_index.

Note

Not all hook operations are supported yet, see 27.

Form finisher

A form finisher is provided to integrate indexing into form extension.

Add form finisher to your available finishers and configure it like:

-
    identifier: SearchCoreIndexer
    options:
        action: 'delete'
        indexIdentifier: 'fe_users'
        recordUid: '{FeUser.user.uid}'

All three options are necessary, where:

action

Is one of delete, update or add.

indexIdentifier

Is a configured index identifier.

recordUid

Has to be the uid of the record to index.

Searching / Frontend Plugin

To provide a search interface you can insert the frontend Plugin as normal content element of type plugin. The plugin is named Search Core.

Please provide your own template, the extension will not deliver a useful template for now.

The Extbase mapping is used, this way you can create a form:

<f:form name="searchRequest" object="{searchRequest}">
    <f:form.textfield property="query" />
    <f:form.submit value="search" />
</f:form>

Filter

Thanks to Extbase mapping, filter are added to the form:

<f:form.textfield property="filter.exampleName" value="the value to match" />

Facets

To add a facet as criteria for searching, use usage_searching_filter.

To display facet results use:

<f:for each="{searchResult.facets}" as="facet">
    <f:for each="{facet.options}" as="option">
        <label for="{option.name}-desktop">
            <f:form.checkbox value="{option.name}" property="filter.{facet.field}" />
            {f:translate(id: 'search.filter.channel.{option.name}', default: option.name, extensionName: 'SitePackage')}
            ({option.count})
        </label>
    </f:for>
</f:for>