提问要多花一点心思哦

多语言搜索,中文拼音+其他语言+首字母排序

Elasticsearch | 作者 gaol | 发布于2019年09月23日 | 阅读数:1548

大神给看看,中文拼音+小语种+首字母排序:排序有问题,有特殊符号的老排前边
 {
"mappings":{
"properties":{
"bookId": {
"type": "keyword"
},
"title":{
"type":"text",
"analyzer":"ikSearchAnalyzer",
"fields":{
"spy":{
"type":"text",
"analyzer":"pinyiSimpleIndexAnalyzer"
},
"standard":{
"type": "text",
"analyzer":"standard"
},
"fpy":{
"type":"text",
"analyzer":"pinyiFullIndexAnalyzer"
},
"sort": {
"type": "icu_collation_keyword",
"index": false,
"language": "zh",
"country": "CN"
}
}
},
"subTitle":{
"type":"text",
"analyzer":"ikSearchAnalyzer",
"fields":{
"spy":{
"type":"text",
"analyzer":"pinyiSimpleIndexAnalyzer"
},
"standard":{
"type": "text",
"analyzer":"standard"
},
"fpy":{
"type":"text",
"analyzer":"pinyiFullIndexAnalyzer"
}
}
},
"classno":{
"type": "keyword"
},
"className": {
"type": "keyword"
},
"author": {
"type": "text",
"analyzer":"ikSearchAnalyzer",
"fields":{
"spy":{
"type":"text",
"analyzer":"pinyiSimpleIndexAnalyzer"
},
"standard":{
"type": "text",
"analyzer":"standard"
},
"fpy":{
"type":"text",
"analyzer":"pinyiFullIndexAnalyzer"
}
}
},
"isbn": {
"type": "keyword"
},
"publisher": {
"type": "text",
"analyzer":"ikSearchAnalyzer",
"fields":{
"spy":{
"type":"text",
"analyzer":"pinyiSimpleIndexAnalyzer"
},
"standard":{
"type": "text",
"analyzer":"standard"
},
"fpy":{
"type":"text",
"analyzer":"pinyiFullIndexAnalyzer"
}
}
},
"pubYear": {
"type": "date",
"format": "yyyy"
},
"star": {
"type": "integer"
},
"lan": {
"type": "keyword"
},
"pubDate": {
"type": "keyword"
},
"binding": {
"type": "keyword"
},
"cover": {
"type": "keyword"
},
"createTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||epoch_millis"
},
"updateTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||epoch_millis"
},
"collection": {
"type": "keyword"
}
}
},
"settings":{
"number_of_shards": 3,
"number_of_replicas" : 1,
"analysis" : {
"filter": {
"edge_ngram_filter": {
"type":"edge_ngram",
"min_gram": 1,
"max_gram": 50
},
"pinyin_simple_filter":{
"type" : "pinyin",
"keep_first_letter":true,
"keep_full_pinyin" : false,
"limit_first_letter_length" : 50
},
"pinyin_full_filter":{
"type" : "pinyin",
"keep_first_letter":false,
"keep_full_pinyin" : true,
"none_chinese_pinyin_tokenize":true,
"limit_first_letter_length" : 50,
"padding_char" : " "
},
"t2s_convert":{
"type": "stconvert",
"delimiter": ",",
"convert_type": "t2s"
}
},
"char_filter" : {
"tsconvert" : {
"type" : "stconvert",
"convert_type" : "t2s"
}
},
"analyzer": {
"ngramIndexAnalyzer": {
"type": "custom",
"tokenizer": "keyword",
"filter": ["edge_ngram_filter","lowercase"],
"char_filter" : ["tsconvert"]
},
"ikSearchAnalyzer": {
"type": "custom",
"tokenizer": "ik_max_word",
"char_filter" : ["tsconvert"]
},
"pinyiSimpleIndexAnalyzer":{
"tokenizer" : "keyword",
"filter": ["pinyin_simple_filter","edge_ngram_filter","lowercase"]
},
"pinyiFullIndexAnalyzer":{
"tokenizer" : "keyword",
"filter": ["pinyin_full_filter","lowercase"]
},
"tsconvert" : {
"tokenizer" : "tsconvert"
}
},
"tokenizer" : {
"tsconvert" : {
"type" : "stconvert",
"delimiter" : "#",
"keep_both" : false,
"convert_type" : "t2s"
}
}
}
}
}
已邀请:

doom

赞同来自:

一般名称类的排序是这样的  ! # $ % & ( ) , . ' - ; @ [ ] ^ _ ` { } ~ + = 0 1 2 … 9 A B C … Z 中文

基本是按ASCII码的,有些调整,如括号和下划线调到了前面,数字肯定在字母前,然后就是中文的排序
 

要回复问题请先登录注册