refactor(knowledge): increase page size for tag retrieval in buildTagMap function
- Updated the page size from 100 to 1000 in the buildTagMap function to enhance performance and efficiency when retrieving tags from the knowledge base.
This commit is contained in:
@@ -5901,7 +5901,7 @@ func (s *knowledgeService) ExportFAQEntries(ctx context.Context, kbID string) ([
|
|||||||
|
|
||||||
// buildTagMap builds a map from tag_id to tag_name for the given knowledge base.
|
// buildTagMap builds a map from tag_id to tag_name for the given knowledge base.
|
||||||
func (s *knowledgeService) buildTagMap(ctx context.Context, tenantID uint64, kbID string) (map[string]string, error) {
|
func (s *knowledgeService) buildTagMap(ctx context.Context, tenantID uint64, kbID string) (map[string]string, error) {
|
||||||
const pageSize = 100
|
const pageSize = 1000
|
||||||
tagMap := make(map[string]string)
|
tagMap := make(map[string]string)
|
||||||
|
|
||||||
for pageNum := 1; ; pageNum++ {
|
for pageNum := 1; ; pageNum++ {
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ type Pagination struct {
|
|||||||
// Page
|
// Page
|
||||||
Page int `form:"page" json:"page" binding:"omitempty,min=1"`
|
Page int `form:"page" json:"page" binding:"omitempty,min=1"`
|
||||||
// Page size
|
// Page size
|
||||||
PageSize int `form:"page_size" json:"page_size" binding:"omitempty,min=1,max=100"`
|
PageSize int `form:"page_size" json:"page_size" binding:"omitempty,min=1,max=1000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPage gets the page number, default is 1
|
// GetPage gets the page number, default is 1
|
||||||
@@ -191,8 +191,8 @@ func (p *Pagination) GetPageSize() int {
|
|||||||
if p.PageSize < 1 {
|
if p.PageSize < 1 {
|
||||||
return 20
|
return 20
|
||||||
}
|
}
|
||||||
if p.PageSize > 100 {
|
if p.PageSize > 1000 {
|
||||||
return 100
|
return 1000
|
||||||
}
|
}
|
||||||
return p.PageSize
|
return p.PageSize
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user