You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

indexer.go 856 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2018 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. // IndexerData data stored in the issue indexer
  6. type IndexerData struct {
  7. ID int64
  8. RepoID int64
  9. Title string
  10. Content string
  11. Comments []string
  12. IsDelete bool
  13. IDs []int64
  14. }
  15. // Match represents on search result
  16. type Match struct {
  17. ID int64 `json:"id"`
  18. RepoID int64 `json:"repo_id"`
  19. Score float64 `json:"score"`
  20. }
  21. // SearchResult represents search results
  22. type SearchResult struct {
  23. Hits []Match
  24. }
  25. // Indexer defines an inteface to indexer issues contents
  26. type Indexer interface {
  27. Init() (bool, error)
  28. Index(issue []*IndexerData) error
  29. Delete(ids ...int64) error
  30. Search(kw string, repoID int64, limit, start int) (*SearchResult, error)
  31. }