Skip to content

Commit

Permalink
chore: fix icon link
Browse files Browse the repository at this point in the history
  • Loading branch information
medcl authored and bindiego committed Jan 19, 2025
1 parent 219ad28 commit 4630930
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 24 deletions.
22 changes: 22 additions & 0 deletions docs/content.en/docs/references/connectors/hugo_site.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ curl -XPUT http://localhost:9000/connector/hugo_site?replace=true -d '{

> Use `hugo_site` as a unique identifier, as it is a builtin connector.
Make sure hugo generated the json format with this:
```
[
{
"category": "Product",
"content": "INFINI Console v1.28 Released We’re excited to announce INFINI Console v1.28, the latest update from INFINI Labs! This release brings the powerful TopN feature to help you identify key metrics efficiently, alongside other performance improvements and bug fixes. Read on for all the details and enhancements in this release.\nWhat is INFINI Console? Great question! INFINI Console is a lightweight, cross-version, unified management platform designed specifically for search infrastructures. It empowers enterprises to:\nManage multiple search clusters across different versions seamlessly. Gain centralized control for efficient cluster monitoring and maintenance. INFINI Console – The Choice of Elasticsearch Professionals. Be an Elasticsearch Pro Today!\nWith INFINI Console, you can streamline the management of your search ecosystem like never before! 🚀\nLearn more here: ",
"created": "2025-01-11T17:00:00+08:00",
"lang": "en",
"subcategory": "Released",
"summary": "Discover the new TopN feature and other enhancements in INFINI Console v1.28.",
"tags": [
"Console",
"TopN",
"Release"
],
"title": "INFINI Console v1.28 Released",
"updated": null,
"url": "/posts/2025/01-11-produc-released-console-topn/"
}
]
```

## Update coco-server's config

Below is an example configuration for enabling the Hugo Site Drive Connector in coco-server:
Expand Down
10 changes: 5 additions & 5 deletions plugins/connectors/google_drive/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getIcon(fileType string) string {
}
}

func (this *Plugin) startIndexingFiles(tenantID, userID, datasourceID string, tok *oauth2.Token) {
func (this *Plugin) startIndexingFiles(connector *common.Connector, datasource *common.DataSource, tenantID, userID string, tok *oauth2.Token) {
var filesProcessed = 0
defer func() {
if !global.Env().IsDebug {
Expand Down Expand Up @@ -96,7 +96,7 @@ func (this *Plugin) startIndexingFiles(tenantID, userID, datasourceID string, to
var query string

//get last access time from kv
lastModifiedTimeStr, _ := this.getLastModifiedTime(tenantID, userID, datasourceID)
lastModifiedTimeStr, _ := this.getLastModifiedTime(tenantID, userID, datasource.ID)

log.Tracef("get last modified time: %v", lastModifiedTimeStr)

Expand Down Expand Up @@ -159,8 +159,8 @@ func (this *Plugin) startIndexingFiles(tenantID, userID, datasourceID string, to
// Map Google Drive file to Document struct
document := common.Document{
Source: common.DataSourceReference{
//ID: "",//TODO
Name: "google_drive",
ID: datasource.ID,
Name: datasource.Name,
Type: "connector",
},
Title: i.Name,
Expand Down Expand Up @@ -244,7 +244,7 @@ func (this *Plugin) startIndexingFiles(tenantID, userID, datasourceID string, to
if lastModifyTime != nil {
// Save the lastModifyTime (for example, in a KV store or file)
lastModifiedTimeStr = lastModifyTime.Format(time.RFC3339Nano)
err := this.saveLastModifiedTime(tenantID, userID, lastModifiedTimeStr, datasourceID)
err := this.saveLastModifiedTime(tenantID, userID, lastModifiedTimeStr, datasource.ID)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/connectors/google_drive/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (this *Plugin) fetch_google_drive(connector *common.Connector, datasource *
log.Warnf("skip invalid google_drive token: %v", tok)
} else {
log.Debug("start processing google drive files")
this.startIndexingFiles(tenantID, userID, datasource.ID, &tok)
this.startIndexingFiles(connector, datasource, tenantID, userID, &tok)
log.Debug("finished process google drive files")
}
}
Expand Down
34 changes: 17 additions & 17 deletions plugins/connectors/yuque/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (this *Plugin) save(obj interface{}) {
}
}

func (this *Plugin) collect(cfg *YuqueConfig) {
func (this *Plugin) collect(connector *common.Connector, datasource *common.DataSource, cfg *YuqueConfig) {

token := cfg.Token

Expand All @@ -82,18 +82,18 @@ func (this *Plugin) collect(cfg *YuqueConfig) {

//get users in group
if cfg.IndexingUsers || cfg.IndexingGroups {
this.collectUsers(currentUser.Group.Login, token, cfg)
this.collectUsers(connector, datasource, currentUser.Group.Login, token, cfg)
}

//get all books
if cfg.IndexingBooks || cfg.IndexingDocs {
this.collectBooks(currentUser.Group.Login, token, cfg)
this.collectBooks(connector, datasource, currentUser.Group.Login, token, cfg)
}

log.Infof("finished collecting for %v", currentUser.Group.Login)
}

func (this *Plugin) collectBooks(login, token string, cfg *YuqueConfig) {
func (this *Plugin) collectBooks(connector *common.Connector, datasource *common.DataSource, login, token string, cfg *YuqueConfig) {

const limit = 100
offset := 0
Expand Down Expand Up @@ -130,8 +130,8 @@ func (this *Plugin) collectBooks(login, token string, cfg *YuqueConfig) {
//index books
document := common.Document{
Source: common.DataSourceReference{
//ID: "",//TODO
Name: YuqueKey,
ID: datasource.ID,
Name: datasource.Name,
Type: "connector",
},
Title: bookDetail.Book.Name,
Expand Down Expand Up @@ -175,7 +175,7 @@ func (this *Plugin) collectBooks(login, token string, cfg *YuqueConfig) {

//get docs in repo
if cfg.IndexingDocs {
this.collectDocs(login, bookID, token, cfg)
this.collectDocs(connector, datasource, login, bookID, token, cfg)
}
}

Expand All @@ -188,7 +188,7 @@ func (this *Plugin) collectBooks(login, token string, cfg *YuqueConfig) {

}

func (this *Plugin) collectDocs(login string, bookID int64, token string, cfg *YuqueConfig) {
func (this *Plugin) collectDocs(connector *common.Connector, datasource *common.DataSource, login string, bookID int64, token string, cfg *YuqueConfig) {

const limit = 100
offset := 0
Expand All @@ -213,7 +213,7 @@ func (this *Plugin) collectDocs(login string, bookID int64, token string, cfg *Y
for _, doc := range doc.Docs {
if cfg.IndexingDocs && (doc.Public > 0 || (cfg.IncludePrivateDoc)) {
//get doc details
this.collectDocDetails(bookID, doc.ID, token, cfg)
this.collectDocDetails(connector, datasource, bookID, doc.ID, token, cfg)
} else {
log.Debug("skip doc:", doc.Title, ",", doc.Public)
}
Expand All @@ -228,7 +228,7 @@ func (this *Plugin) collectDocs(login string, bookID int64, token string, cfg *Y

}

func (this *Plugin) collectDocDetails(bookID int64, docID int64, token string, cfg *YuqueConfig) {
func (this *Plugin) collectDocDetails(connector *common.Connector, datasource *common.DataSource, bookID int64, docID int64, token string, cfg *YuqueConfig) {

res := get(fmt.Sprintf("/api/v2/repos/%v/docs/%v", bookID, docID), token)
doc := struct {
Expand All @@ -244,8 +244,8 @@ func (this *Plugin) collectDocDetails(bookID int64, docID int64, token string, c
//index doc
document := common.Document{
Source: common.DataSourceReference{
//ID: "",//TODO
Name: YuqueKey,
ID: datasource.ID,
Name: datasource.Name,
Type: "connector",
},
Title: doc.Doc.Title,
Expand Down Expand Up @@ -301,7 +301,7 @@ func (this *Plugin) collectDocDetails(bookID int64, docID int64, token string, c
}
}

func (this *Plugin) collectUsers(login, token string, cfg *YuqueConfig) {
func (this *Plugin) collectUsers(connector *common.Connector, datasource *common.DataSource, login, token string, cfg *YuqueConfig) {
const pageSize = 100
offset := 0

Expand Down Expand Up @@ -338,8 +338,8 @@ func (this *Plugin) collectUsers(login, token string, cfg *YuqueConfig) {

document = common.Document{
Source: common.DataSourceReference{
//ID: "",//TODO
Name: YuqueKey,
ID: datasource.ID,
Name: datasource.Name,
Type: "connector",
},
Title: groupUser.User.Name,
Expand All @@ -366,8 +366,8 @@ func (this *Plugin) collectUsers(login, token string, cfg *YuqueConfig) {

document = common.Document{
Source: common.DataSourceReference{
//ID: "",//TODO
Name: YuqueKey,
ID: datasource.ID,
Name: datasource.Name,
Type: "connector",
},
Title: groupUser.Group.Name,
Expand Down
2 changes: 1 addition & 1 deletion plugins/connectors/yuque/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (this *Plugin) fetch_yuque(connector *common.Connector, datasource *common.
}

log.Debugf("handle hugo_site's datasource: %v", obj)
this.collect(&obj)
this.collect(connector, datasource, &obj)
}

func init() {
Expand Down

0 comments on commit 4630930

Please sign in to comment.