mynote release
mynote release
r190227
2019-5-22 发布
r190522
SHA-1: 6ceeadd865c1da77a70fa089659dc4e987eca788
* 【更新】- 没有更多内容不要再展示加载更多按钮(更多作者页面)
部署项目:
SHA-1: d70dface130d00ca2e11158f1f162368e5a53f8c
* Gogs/es/sms configs
fastadmin:
SHA-1: efb4346bbb22c78276572c2b0ef35503018123f1
* give exe auth to *.sh
停服、备份、部署、启动、测试
es 部署
短信、邮件
UI2.0
编辑器升级
标签系统
重构
composer
config
-- 分类标签表
DROP TABLE IF EXISTS `artag_classify`;
CREATE TABLE IF NOT EXISTS `artag_classify`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`tag` VARCHAR(128) NOT NULL COMMENT '分类标签名',
`time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态(单选):0=不显示,1=显示',
PRIMARY KEY(`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章分类标签表管理';
INSERT INTO `artag_classify` (`id`, `tag`, `status`) VALUES ('1', '阅读', '1');
-- 文章标签表
DROP TABLE IF EXISTS `artag`;
CREATE TABLE IF NOT EXISTS `artag`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`tag` VARCHAR(128) NOT NULL COMMENT '标签',
`time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态(单选):0=不显示,1=显示',
PRIMARY KEY(`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章标签表管理';
-- 用户常用标签表
DROP TABLE IF EXISTS `artag_user`;
CREATE TABLE IF NOT EXISTS `artag_user`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`tag` VARCHAR(128) NOT NULL COMMENT '标签',
`uid` INT UNSIGNED NOT NULL COMMENT '用户ID',
`time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态(单选):0=不显示,1=显示',
PRIMARY KEY(`id`),
KEY `uid` (`uid`),
KEY `tag` (`tag`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章标签表管理';
-- 文章标签关系表
DROP TABLE IF EXISTS `artag_user_relation`;
CREATE TABLE IF NOT EXISTS `artag_user_relation`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`aid` INT UNSIGNED NOT NULL COMMENT '文章ID',
`tagid` INT UNSIGNED NOT NULL COMMENT '标签ID',
`time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '状态(单选):0=文章标签,1=用户常用标签',
PRIMARY KEY(`id`),
KEY `aid` (`aid`),
KEY `tagid` (`tagid`),
UNIQUE KEY `aid_tagid_status` (`aid`, `tagid`,`status`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章标签表管理';
-- 文章分类关系表
DROP TABLE IF EXISTS `artag_classify_relation`;
CREATE TABLE IF NOT EXISTS `artag_classify_relation`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`aid` INT UNSIGNED NOT NULL COMMENT '文章ID',
`artag_classify_id` INT UNSIGNED NOT NULL COMMENT '分类标签ID',
`time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态(单选):0=不显示,1=显示',
PRIMARY KEY(`id`),
KEY `aid` (`aid`),
KEY `artag_classify_id` (`artag_classify_id`),
UNIQUE KEY `aid_artag_classify_id` (`aid`, `artag_classify_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章分类关系表管理';
run as www user in /home/www/fastadmin
php think crud -t artag -c mynote/artag -m artag --force=true
php think menu -c mynote/artag --force=true
php think crud -t artag_classify -c mynote/artagclassify -m artagclassify --force=true
php think menu -c mynote/artagclassify --force=true
es
1 删除index(如果有)
DELETE /mynote
2 建立mapping
PUT /mynote
{
"settings": {
"analysis": {
"analyzer": {
"ik_pinyin_analyzer": {
"type":"custom",
"tokenizer": "ik_smart",
"filter": ["my_pinyin","word_delimiter"]
}
},
"filter": {
"my_pinyin": {
"keep_joined_full_pinyin": "true",
"keep_none_chinese_in_first_letter": "false",
"lowercase": "true",
"keep_original": "false",
"keep_first_letter": "false",
"trim_whitespace": "true",
"type": "pinyin",
"keep_none_chinese": "false",
"limit_first_letter_length": "16",
"keep_full_pinyin": "false"
}
}
}
},
"mappings":{
"article":{
"properties":{
"abstract":{
"type":"text",
"analyzer":"ik_max_word"
},
"article_id":{
"type":"keyword"
},
"content":{
"type":"text",
"fields":{
"pinyin":{
"type":"text",
"analyzer":"ik_pinyin_analyzer"
}
},
"analyzer":"ik_max_word"
},
"id":{
"type":"long"
},
"recommend":{
"type":"byte"
},
"sort":{
"type":"long"
},
"status":{
"type":"byte"
},
"tag":{
"type":"keyword"
},
"thum":{
"type":"text"
},
"time":{
"type":"date"
},
"title":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
},
"pinyin":{
"type":"text",
"analyzer":"ik_pinyin_analyzer"
}
},
"analyzer":"ik_max_word"
},
"updata_time":{
"type":"date"
},
"username":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
},
"pinyin":{
"type":"text",
"analyzer":"ik_pinyin_analyzer"
}
},
"analyzer":"ik_max_word"
}
}
}
}
}
3 访问此链接,建立文章索引
http://uninote.com.cn/api/synes
4 搜索测试,查询条件替换红色部分,注意中文搜索测试
GET /mynote/article/_search
{
"query": {
"dis_max": {
"tie_breaker": 0.7,
"boost": 1.2,
"queries": [
{
"bool": {
"should": [
{
"multi_match": {
"query": "日志",
"fields": ["content", "content.pinyin", "username", "username.pinyin", "title","title.pinyin"],
"analyzer":"ik_max_word"
}
},
{
"term": {
"tag": {
"value": "日志"
}
}
}
]
}
}
]
}
},
"highlight": {
"fields": [
{"tag" :{}},
{"title" :{}},
{"content" :{}},
{"username" :{}},
{"title.pinyin" :{}},
{"content.pinyin" :{}},
{"username.pinyin" :{}}
]
},
"size": 10,
"from": 0,
"_source":[
"highlight", "title", "article_id", "title", "abstract", "thum", "id"
]
}