Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/visuellverstehen/t3meilisearch
Use Meilisearch for your TYPO3 search
https://github.com/visuellverstehen/t3meilisearch
meilisearch meilisearch-php typo3 typo3-cms-extension
Last synced: 29 days ago
JSON representation
Use Meilisearch for your TYPO3 search
- Host: GitHub
- URL: https://github.com/visuellverstehen/t3meilisearch
- Owner: visuellverstehen
- License: mit
- Created: 2022-02-07T10:29:23.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-07T08:15:16.000Z (8 months ago)
- Last Synced: 2024-11-14T20:48:36.382Z (about 1 month ago)
- Topics: meilisearch, meilisearch-php, typo3, typo3-cms-extension
- Language: PHP
- Homepage:
- Size: 115 KB
- Stars: 2
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# t3meilisearch
## Preparation
Install Meilisearch yourself and make sure it is running. Also make sure you get the host address the server is reachable at, because you will need to configure the extension with that host. Otherwhise the extension cannot communicate with Meilisearch.
You will also need `poppler-utils` in order to index PDF files.
## Installation
You can easily install the extension by using Composer:
```bash
composer require visuellverstehen/t3meilisearch
```You may have to activate the extension in TYPO3 10.4, but since TYPO3 11.5 this is not required anymore.
## Configuration
Log into TYPO3 as an admin or systemmaintainer and go to the settings module. Adjust the configure for t3meilisearch by setting the following fields:
### Host
The address the Meilisearch server is reachable at. Optionaly including the port.
Example:
```
host=127.0.0.1:7700
```### Api
The key to authenticate the requests
Example:
```
apiKey=masterKey
```### Target page uid
The uid of the page where the main plugin lives (see [Usage](#usage)).
Example:
```
targetPid=56
```### Index
You can define a custom index by replacing the default value provided by t3meilisearch.
Example:
```
index=content
```Thats pretty much it. The extension will then index pages and pdfs after they've been cached.
It is recommended to create a new page which can be hidden but not disabled. Insert the plugin »Searchform with results (Pi1)«. This will show a search form and also results if available.
You can also use the »Searchform (Pi2)« plugin to only display a search form wich will redirect to the target page configured in the settings module. You may insert this plugin hardcoded into e.g. the footer like this:
```html
```### Parsing content
By default everything inbetween `` is beeing indexed. You can limit this by using two HTML comments just like indexed_search does. If you use multiple blocks, only the first will be index.
```html
This content will be indexed
This content will NOT be indexed
```### Overriding templates
Because it's a basic TYPO3 extension build using Extbase, you can easily override the default templates and use you own. First configure an additional location for your templates and partials in your TypoScript for TYPO3 to look in:
```
plugin.tx_t3meilisearch {
view {
templateRootPaths {
5000 = EXT:custom_extension/Resources/Private/Templates/
}
partialRootPaths {
5000 = EXT:custom_extension/Resources/Private/Partials/
}
}
}
```Next you can copy and modify the default templates the way you like. It is important to replicate the namespace structure, otherwhise TYPO3 cannot find the templates and partials.
### Exclude pages from indexing
You can disable the »Include in Search« checkbox when editing a page to prevent a page beeing indexed.
### Dropping the index
Want a clear start? You can simply execute a HTTP request to drop the index:
```bash
curl -H 'Authorization: Bearer yourApiKey' -X DELETE 'http://localhost:7700/indexes/documents'
```A new index with the name configured in `$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['t3meilisearch']['index']` will be created by t3meilisearch.
### Removing specific documents
When there are old or unwanted results, you can easily remove the documents by executing a HTTP request. First find the `id` of the document by searching through the Meilisearch dashboard. Then you can execute the following request to delete a document:
```bash
curl -H 'Authorization: Bearer yourApiKey' -X DELETE 'http://localhost:7700/indexes/documents/documents/:id'
```### Add sorting option
By default t3meilisearch sorts the results by crdate (filetime for PDFs) descending. You can add simple sorting options by adding a select:
```html
Sorting
New first
Old first```
It is important that the sorting value is passed by the query key called `sorting`. The value is composed by `column-to-sort_direction-to-sort`. If you want more complex sorting you have to do it yourself.
### Add type filtering
By default we add a two type to documents. `page` for normale page content and `pdf` for PDF files. You could index records yourself and add custom types. Filtering for types can be achieved by passing a `types` parameter:
```html
f:for(each: '{queryParams.types}', as: 'type')}>
Allgemein
```---
Meilisearch has an easy API to use: [docs.meilisearch.com](https://docs.meilisearch.com/reference/api/)