mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-22 07:18:31 -04:00
Improve issue search (#2387)
* Improve issue indexer * Fix new issue sqlite bug * Different test indexer paths for each db * Add integration indexer paths to make clean
This commit is contained in:
parent
52e11b24bf
commit
b0f7457d9e
122 changed files with 15280 additions and 1458 deletions
|
@ -155,6 +155,17 @@ func (issue *Issue) loadPullRequest(e Engine) (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (issue *Issue) loadComments(e Engine) (err error) {
|
||||
if issue.Comments != nil {
|
||||
return nil
|
||||
}
|
||||
issue.Comments, err = findComments(e, FindCommentsOptions{
|
||||
IssueID: issue.ID,
|
||||
Type: CommentTypeUnknown,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (issue *Issue) loadAttributes(e Engine) (err error) {
|
||||
if err = issue.loadRepo(e); err != nil {
|
||||
return
|
||||
|
@ -191,14 +202,8 @@ func (issue *Issue) loadAttributes(e Engine) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if issue.Comments == nil {
|
||||
issue.Comments, err = findComments(e, FindCommentsOptions{
|
||||
IssueID: issue.ID,
|
||||
Type: CommentTypeUnknown,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("getCommentsByIssueID [%d]: %v", issue.ID, err)
|
||||
}
|
||||
if err = issue.loadComments(e); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -577,7 +582,7 @@ func updateIssueCols(e Engine, issue *Issue, cols ...string) error {
|
|||
if _, err := e.Id(issue.ID).Cols(cols...).Update(issue); err != nil {
|
||||
return err
|
||||
}
|
||||
UpdateIssueIndexer(issue)
|
||||
UpdateIssueIndexer(issue.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -907,8 +912,6 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
UpdateIssueIndexer(opts.Issue)
|
||||
|
||||
if len(opts.Attachments) > 0 {
|
||||
attachments, err := getAttachmentsByUUIDs(e, opts.Attachments)
|
||||
if err != nil {
|
||||
|
@ -947,6 +950,8 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
|
|||
return fmt.Errorf("Commit: %v", err)
|
||||
}
|
||||
|
||||
UpdateIssueIndexer(issue.ID)
|
||||
|
||||
if err = NotifyWatchers(&Action{
|
||||
ActUserID: issue.Poster.ID,
|
||||
ActUser: issue.Poster,
|
||||
|
@ -1448,7 +1453,7 @@ func updateIssue(e Engine, issue *Issue) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
UpdateIssueIndexer(issue)
|
||||
UpdateIssueIndexer(issue.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue