@@ -560,6 +560,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
560560 return
561561 }
562562
563+ var keywordMatchedIssueIds []int64
563564 var issueStats * issues_model.IssueStats
564565 statsOpts := & issues_model.IssuesOptions {
565566 RepoIDs : []int64 {repo .ID },
@@ -575,7 +576,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
575576 IssueIDs : nil ,
576577 }
577578 if keyword != "" {
578- allIssueIDs , err : = issueIDsFromSearch (ctx , keyword , statsOpts )
579+ keywordMatchedIssueIds , err = issueIDsFromSearch (ctx , keyword , statsOpts )
579580 if err != nil {
580581 if issue_indexer .IsAvailable (ctx ) {
581582 ctx .ServerError ("issueIDsFromSearch" , err )
@@ -584,7 +585,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
584585 ctx .Data ["IssueIndexerUnavailable" ] = true
585586 return
586587 }
587- statsOpts .IssueIDs = allIssueIDs
588+ statsOpts .IssueIDs = keywordMatchedIssueIds
588589 }
589590 if keyword != "" && len (statsOpts .IssueIDs ) == 0 {
590591 // So it did search with the keyword, but no issue found.
@@ -641,7 +642,9 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
641642
642643 var issues issues_model.IssueList
643644 {
644- ids , err := issueIDsFromSearch (ctx , keyword , & issues_model.IssuesOptions {
645+ // Do not repeat the keyword search, since if we had any keyword matches we should
646+ // already have their IDs available in allMatchingIssueIDs.
647+ ids , err := issueIDsFromSearch (ctx , "" , & issues_model.IssuesOptions {
645648 Paginator : & db.ListOptions {
646649 Page : pager .Paginater .Current (),
647650 PageSize : setting .UI .IssuePagingNum ,
@@ -658,6 +661,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
658661 IsPull : isPullOption ,
659662 LabelIDs : labelIDs ,
660663 SortType : sortType ,
664+ IssueIDs : keywordMatchedIssueIds ,
661665 })
662666 if err != nil {
663667 if issue_indexer .IsAvailable (ctx ) {
0 commit comments