oat-sa / lib-tao-elasticsearch
使用Elasticsearch在Tao中进行搜索的库
v2.5.2
2022-09-12 12:26 UTC
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-09-24 15:50:53 UTC
README
这个库现在不应再使用,因为它与Tao扩展紧密耦合,其代码无法用于其他应用程序。
请参考高级搜索扩展,当实现与TAO平台搜索相关的Elasticsearch集成时。
lib-tao-elasticsearch
Elastic Search搜索引擎
安装
基于cli脚本的安装方法
sudo php vendor/oat-sa/lib-tao-elasticsearch/bin/activateElasticSearch.php <pathToTaoRoot> <host> <port> <login> <password>
pathToTaoRoot
是您的Tao根目录host
是您的Elasticsearch环境的主机。默认为localhost
。port
是您的Elasticsearch环境的端口号。默认为9200
。login
是您的Elasticsearch环境的登录名。可选属性。password
是您的Elasticsearch环境的密码。可选属性。
基于种子文件的安装方法
以下内容应包含在种子文件中,并描述了一个引擎、连接字符串、服务配置和回退
"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"
}
}
}
}
在安装阶段创建适当的索引结构时,可以使用以下内容,其中 indexFiles
包含声明的绝对路径,示例在此库中提供(@TODO 应解耦)
"postInstall": [
{
"class": "\\oat\\tao\\elasticsearch\\Action\\IndexCreator",
"params": [
"--indexFiles",
"/var/www/html/vendor/oat-sa/lib-tao-elasticsearch/config/index.conf.php"
]
}
]
设置
Add your elasticsearch host to the config/tao/search.conf.php like
'hosts' => array(
'https://: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
完成此步骤后,您需要将文档填充到索引中。为此,您必须运行
$ bash tao/scripts/tools/index/IndexPopulator.sh <TAO_PLATFORM_ROOT>
此脚本将索引TAO平台上的所有资源以供Elasticsearch使用。