Skip to content

Commit

Permalink
Merge pull request #346 from phachon/feat/v0.2.2/phachon
Browse files Browse the repository at this point in the history
[feat]: del vendor; add version
  • Loading branch information
phachon authored Apr 16, 2022
2 parents bb03258 + a2b00ab commit bdd79cd
Show file tree
Hide file tree
Showing 85 changed files with 44 additions and 11,268 deletions.
23 changes: 11 additions & 12 deletions app/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/fatih/color"
"github.com/go-ego/riot/types"
"github.com/phachon/mm-wiki/app/models"
"github.com/phachon/mm-wiki/app/utils"
"github.com/phachon/mm-wiki/app/work"
Expand Down Expand Up @@ -254,17 +253,17 @@ func initSearch() {
logs.Error("search stop dict file " + stopFile + " is not exists!")
os.Exit(1)
}
global.DocSearcher.Init(types.EngineOpts{
UseStore: true,
StoreFolder: SearchIndexAbsDir,
Using: 3,
//GseDict: "zh",
GseDict: gseFile,
StopTokenFile: stopFile,
IndexerOpts: &types.IndexerOpts{
IndexType: types.LocsIndex,
},
})
//global.DocSearcher.Init(types.EngineOpts{
// UseStore: true,
// StoreFolder: SearchIndexAbsDir,
// Using: 3,
// //GseDict: "zh",
// GseDict: gseFile,
// StopTokenFile: stopFile,
// IndexerOpts: &types.IndexerOpts{
// IndexType: types.LocsIndex,
// },
//})
}

func initWork() {
Expand Down
23 changes: 7 additions & 16 deletions app/services/doc_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ package services
import (
"sync"

"github.com/phachon/mm-wiki/app/models"
"github.com/phachon/mm-wiki/global"

"github.com/astaxie/beego/logs"
"github.com/go-ego/riot/types"
"github.com/phachon/mm-wiki/app/models"
)

var DocIndexService = NewDocIndexService()
Expand Down Expand Up @@ -35,9 +32,8 @@ func (di *DocIndex) ForceDelDocIdIndex(docId string) {
if !di.IsUpdateDocIndex() {
return
}
// add search index
data := types.DocData{Content: ""}
global.DocSearcher.IndexDoc(docId, data, true)
// todo add search index

}

// UpdateDocIndex 更新单个文件的索引
Expand All @@ -52,13 +48,11 @@ func (di *DocIndex) ForceUpdateDocIndexByDocId(docId string) error {
if err != nil {
return err
}
content, _, err := models.DocumentModel.GetDocumentContentByDocument(doc)
_, _, err = models.DocumentModel.GetDocumentContentByDocument(doc)
if err != nil {
return err
}
// add search index
data := types.DocData{Content: content}
global.DocSearcher.IndexDoc(docId, data, true)
// todo add search index
return nil
}

Expand All @@ -71,14 +65,12 @@ func (di *DocIndex) UpdateDocIndex(doc map[string]string) {
if !di.IsUpdateDocIndex() {
return
}
content, _, err := models.DocumentModel.GetDocumentContentByDocument(doc)
_, _, err := models.DocumentModel.GetDocumentContentByDocument(doc)
if err != nil {
logs.Error("[UpdateDocIndex] get documentId=%s content err: %s", docId, err.Error())
return
}
// add search index
data := types.DocData{Content: content}
global.DocSearcher.IndexDoc(docId, data)
// todo add search index
}

// UpdateDocsIndex 批量更新多个文件的索引
Expand Down Expand Up @@ -145,5 +137,4 @@ func (di *DocIndex) getBatchDocs(allDocs []map[string]string, n int) [][]map[str

// FlushIndex 所有索引
func (di *DocIndex) Flush() {
global.DocSearcher.Flush()
}
4 changes: 2 additions & 2 deletions global/search.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package global

import (
"github.com/go-ego/riot"
//"github.com/go-ego/riot"
)

// 文档搜索
var (
DocSearcher = riot.Engine{}
//DocSearcher = riot.Engine{}
)
4 changes: 2 additions & 2 deletions global/system.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package global

const (
SYSTEM_VERSION = "v0.2.1" // system version code
SYSTEM_COPYRIGHT = "2018 - 2020 phachon" // system copyright
SYSTEM_VERSION = "v0.2.2" // system version code
SYSTEM_COPYRIGHT = "2018 - 2022 phachon" // system copyright
)
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ module github.com/phachon/mm-wiki

go 1.12

replace github.com/coreos/go-systemd => ./vendor/github.com/coreos/go-systemd

require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/astaxie/beego v1.12.0
github.com/fatih/color v1.7.0
github.com/go-ego/riot v0.0.0-20191215221243-bdbc256e4cbd
github.com/go-ldap/ldap/v3 v3.1.11
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
github.com/go-sql-driver/mysql v1.4.1
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.10.3 // indirect
github.com/onsi/gomega v1.7.1 // indirect
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
github.com/shirou/gopsutil v2.19.11+incompatible
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/snail007/go-activerecord v0.0.0-20190813031814-2ac2f3d7cff0
github.com/stretchr/testify v1.7.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/russross/blackfriday.v2 v2.0.0
Expand Down
Loading

0 comments on commit bdd79cd

Please sign in to comment.