oat-sa / lib-tao-elasticsearch
Library to search in Tao using Elasticsearch
Requires
- php: >=7.1
- elasticsearch/elasticsearch: ~7.0
- oat-sa/tao-core: >=50.5.0||dev-develop
- dev-master
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.0
- 2.3.1
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- v2.1.0
- 2.0.0
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- dev-feature/sonarqube-integration
- dev-feat/RFE-530/integration-branch
- dev-develop
- dev-release-2.2.0
- dev-feature/TAO-10203-advanced-search
- dev-fix/con-330/fix-classMetadata-issue
- dev-feature/con-121/advanced-search-in-results
- dev-feature/con-134/search-modal-universal-query
- dev-fix/con-23/cilent-operation-on-error-throw-exception
- dev-feature/TAO-10365-add-dacl-to-search
This package is auto-updated.
Last update: 2024-11-24 16:07:04 UTC
README
This libary must not be used anymore, since it is tighly coupled with tao extensions and its code is not reusable for other applications.
Please, refer to the Advanced Search extension when implementing elastic search integration related to search in the TAO platform.
lib-tao-elasticsearch
Elastic Search engine
Install:
Cli script based approach
sudo php vendor/oat-sa/lib-tao-elasticsearch/bin/activateElasticSearch.php <pathToTaoRoot> <host> <port> <login> <password>
pathToTaoRoot
it's root path of your taohost
it's host of your elasticsearch environment.localhost
by default.port
it's port of your elasticsearch environment.9200
by default.login
it's login for you elasticsearch environment. Optional property.password
it's password for you elasticsearch environment. Optional property.
Seed file based approach
Following section to be included into seed file and describes an engine, connectivity string, service configuration and fallback
"tao": {
"search": {
"type": "configurableService",
"class": "oat\\tao\\elasticsearch\\ElasticSearch",
"options": {
"hosts": [
{
"host": "elasticsearch",
"port": 9200
}
],
"settings": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 100
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
"oat\\tao\\model\\search\\strategy\\GenerisSearch": {
"type": "configurableService",
"class": "oat\\tao\\model\\search\\strategy\\GenerisSearch"
}
}
}
}
For the proper index structure creation on installation stage following may be used,
where indexFiles
contains the absolute path to the declaration, sample provided within this lib (@TODO should be decoupled)
"postInstall": [
{
"class": "\\oat\\tao\\elasticsearch\\Action\\IndexCreator",
"params": [
"--indexFiles",
"/var/www/html/vendor/oat-sa/lib-tao-elasticsearch/config/index.conf.php"
]
}
]
Setting Up:
Add your elasticsearch host to the config/tao/search.conf.php like
'hosts' => array(
'http://localhost:9200'
),
Add you castom settings, filters or analysis
'settings' => array(
'analysis' => array(
'filter' => array(
'autocomplete_filter' => array(
'type' => 'edge_ngram',
'min_gram' => 1,
'max_gram' => 100
)
),
'analyzer' => array(
'autocomplete' => array(
'type' => 'custom',
'tokenizer' => 'standard',
'filter' => array(
'lowercase',
'autocomplete_filter'
)
)
)
)
),
'isMap' => true
After this step, you need to fill the index with documents. to do this, you must run:
$ bash tao/scripts/tools/index/IndexPopulator.sh <TAO_PLATFORM_ROOT>
This script will index all resources on the TAO platform for elastic search.