mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Add open/closed field support for issue index (#25708)
A couple of notes: * Future changes should refactor arguments into a struct * This filtering only is supported by meilisearch right now * Issue index number is bumped which will cause a re-index
This commit is contained in:
		@@ -15,7 +15,7 @@ type Indexer interface {
 | 
			
		||||
	internal.Indexer
 | 
			
		||||
	Index(ctx context.Context, issue []*IndexerData) error
 | 
			
		||||
	Delete(ctx context.Context, ids ...int64) error
 | 
			
		||||
	Search(ctx context.Context, kw string, repoIDs []int64, limit, start int) (*SearchResult, error)
 | 
			
		||||
	Search(ctx context.Context, kw string, repoIDs []int64, limit, start int, state string) (*SearchResult, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDummyIndexer returns a dummy indexer
 | 
			
		||||
@@ -37,6 +37,6 @@ func (d *dummyIndexer) Delete(ctx context.Context, ids ...int64) error {
 | 
			
		||||
	return fmt.Errorf("indexer is not ready")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *dummyIndexer) Search(ctx context.Context, kw string, repoIDs []int64, limit, start int) (*SearchResult, error) {
 | 
			
		||||
func (d *dummyIndexer) Search(ctx context.Context, kw string, repoIDs []int64, limit, start int, state string) (*SearchResult, error) {
 | 
			
		||||
	return nil, fmt.Errorf("indexer is not ready")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,13 +5,15 @@ package internal
 | 
			
		||||
 | 
			
		||||
// IndexerData data stored in the issue indexer
 | 
			
		||||
type IndexerData struct {
 | 
			
		||||
	ID       int64    `json:"id"`
 | 
			
		||||
	RepoID   int64    `json:"repo_id"`
 | 
			
		||||
	Title    string   `json:"title"`
 | 
			
		||||
	Content  string   `json:"content"`
 | 
			
		||||
	Comments []string `json:"comments"`
 | 
			
		||||
	IsDelete bool     `json:"is_delete"`
 | 
			
		||||
	IDs      []int64  `json:"ids"`
 | 
			
		||||
	ID        int64    `json:"id"`
 | 
			
		||||
	RepoID    int64    `json:"repo_id"`
 | 
			
		||||
	State     string   `json:"state"` // open, closed, all
 | 
			
		||||
	IssueType string   `json:"type"`  // issue or pull
 | 
			
		||||
	Title     string   `json:"title"`
 | 
			
		||||
	Content   string   `json:"content"`
 | 
			
		||||
	Comments  []string `json:"comments"`
 | 
			
		||||
	IsDelete  bool     `json:"is_delete"`
 | 
			
		||||
	IDs       []int64  `json:"ids"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Match represents on search result
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user