Laravel基于Elasticsearch的包——Elasticquent,使用ik分词的设置问题
Elasticsearch | 作者 kanjiushi | 发布于2016年06月18日 | 阅读数:6923
使用Laravel基于Elasticsearch的包(https://github.com/elasticquen ... pping ) ,
**问题:**
1、下面这段配置使用ik分词的时候,应该怎么设置呢?
2、下面代码中的analysis、filter、analyzer三个东西的概念和作用是什么?
```
protected $indexSettings = [
'analysis' => [
'char_filter' => [
'replace' => [
'type' => 'mapping',
'mappings' => [
'&=> and '
],
],
],
'filter' => [
'word_delimiter' => [
'type' => 'word_delimiter',
'split_on_numerics' => false,
'split_on_case_change' => true,
'generate_word_parts' => true,
'generate_number_parts' => true,
'catenate_all' => true,
'preserve_original' => true,
'catenate_numbers' => true,
]
],
'analyzer' => [
'default' => [
'type' => 'custom',
'char_filter' => [
'html_strip',
'replace',
],
'tokenizer' => 'whitespace',
'filter' => [
'lowercase',
'word_delimiter',
],
],
],
],
];
```
**问题:**
1、下面这段配置使用ik分词的时候,应该怎么设置呢?
2、下面代码中的analysis、filter、analyzer三个东西的概念和作用是什么?
```
protected $indexSettings = [
'analysis' => [
'char_filter' => [
'replace' => [
'type' => 'mapping',
'mappings' => [
'&=> and '
],
],
],
'filter' => [
'word_delimiter' => [
'type' => 'word_delimiter',
'split_on_numerics' => false,
'split_on_case_change' => true,
'generate_word_parts' => true,
'generate_number_parts' => true,
'catenate_all' => true,
'preserve_original' => true,
'catenate_numbers' => true,
]
],
'analyzer' => [
'default' => [
'type' => 'custom',
'char_filter' => [
'html_strip',
'replace',
],
'tokenizer' => 'whitespace',
'filter' => [
'lowercase',
'word_delimiter',
],
],
],
],
];
```
3 个回复
medcl - 今晚打老虎。
赞同来自:
2.它们是分词的几个概念,上elastic.co上看看文档吧,比较清晰。
skybao
赞同来自:
$persons = Person::search('美');
dd($persons->getHits());
结果:
array:3 [▼
"total" => 32
"max_score" => 5.3640404
"hits" => array:10 [▶]
]
total 32; hits 10; 请问是什么原因?
medcl - 今晚打老虎。
赞同来自: