This is a custom Phonetic Analysis plugin for brazilian portuguese using MTFN algorithm - an implementation of Metaphone for pt-BR (and mostly compatible with pt-PT).
- JDK 1.8
- Maven 3.x
- Elasticsearch 6.2.1
First of all, make sure that Maven can use MTFN as a dependency. At this time, it is not available in Maven Central, so you can add it to your private repository or install it in your local machine.
git clone https://github.com/ruliana/MTFN.git
cd MTFN
mvn clean install
Then building this plugin is easy as pie.
mvn clean package
You will find the installation package at ./target/releases/
.
This plugin can be installed using the plugin manager, in offline installation mode.
To install analysis-mtfn from your local file system at /path/to/analysis-mtfn.zip
:
sudo bin/elasticsearch-plugin install file:///path/to/analysis-mtfn.zip
Find more information about Elasticsearch plugin offline installation at Plugin Management » Custom URL or file system.
The plugin can be removed with the following command:
sudo bin/elasticsearch-plugin remove analysis-mtfn
You can configure your index to support phonetic searches in brazilian portuguese by adding this plugin as a filter with type phonetic_br
to your index settings, defining a new analyzer and binding it to a field mapping.
{
"settings": {
"analysis": {
"filter": {
"brazilian_phonetic": {
"type": "phonetic_br"
}
},
"analyzer": {
"brazilian_phonetic": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"brazilian_phonetic"
]
}
}
}
},
"mappings": {
"properties": {
"nome": {
"type": "text",
"fields": {
"phonetic": {
"type": "text",
"index": true,
"analyzer": "brazilian_phonetic"
}
}
}
}
}
}
To be defined