本站源代码
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

46 rindas
1.0KB

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package issues
  5. import "code.gitea.io/gitea/models"
  6. // DBIndexer implements Indexer inteface to use database's like search
  7. type DBIndexer struct {
  8. }
  9. // Init dummy function
  10. func (db *DBIndexer) Init() (bool, error) {
  11. return false, nil
  12. }
  13. // Index dummy function
  14. func (db *DBIndexer) Index(issue []*IndexerData) error {
  15. return nil
  16. }
  17. // Delete dummy function
  18. func (db *DBIndexer) Delete(ids ...int64) error {
  19. return nil
  20. }
  21. // Search dummy function
  22. func (db *DBIndexer) Search(kw string, repoID int64, limit, start int) (*SearchResult, error) {
  23. total, ids, err := models.SearchIssueIDsByKeyword(kw, repoID, limit, start)
  24. if err != nil {
  25. return nil, err
  26. }
  27. var result = SearchResult{
  28. Total: total,
  29. Hits: make([]Match, 0, limit),
  30. }
  31. for _, id := range ids {
  32. result.Hits = append(result.Hits, Match{
  33. ID: id,
  34. RepoID: repoID,
  35. })
  36. }
  37. return &result, nil
  38. }
上海开阖软件有限公司 沪ICP备12045867号-1