mirror of
https://github.com/eiblog/eiblog.git
synced 2026-03-01 00:34:58 +08:00
runmode
This commit is contained in:
@@ -28,8 +28,10 @@ var es *ElasticService
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
es = &ElasticService{url: setting.Conf.SearchURL, c: new(http.Client)}
|
es = &ElasticService{url: setting.Conf.SearchURL, c: new(http.Client)}
|
||||||
|
if setting.Conf.RunMode == setting.PROD {
|
||||||
initIndex()
|
initIndex()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func initIndex() {
|
func initIndex() {
|
||||||
mappings := fmt.Sprintf(`{"mappings":{"%s":{"properties":{"content":{"analyzer":"ik_syno","search_analyzer":"ik_syno","term_vector":"with_positions_offsets","type":"string"},"date":{"index":"not_analyzed","type":"date"},"slug":{"type":"string"},"tag":{"index":"not_analyzed","type":"string"},"title":{"analyzer":"ik_syno","search_analyzer":"ik_syno","term_vector":"with_positions_offsets","type":"string"}}}}}`, TYPE)
|
mappings := fmt.Sprintf(`{"mappings":{"%s":{"properties":{"content":{"analyzer":"ik_syno","search_analyzer":"ik_syno","term_vector":"with_positions_offsets","type":"string"},"date":{"index":"not_analyzed","type":"date"},"slug":{"type":"string"},"tag":{"index":"not_analyzed","type":"string"},"title":{"analyzer":"ik_syno","search_analyzer":"ik_syno","term_vector":"with_positions_offsets","type":"string"}}}}}`, TYPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user