Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. }