Documentation ¶
Index ¶
- func DeleteRepoIssueIndexer(repo *repo_model.Repository)
- func InitIssueIndexer(syncReindex bool)
- func IsAvailable() bool
- func SearchIssuesByKeyword(ctx context.Context, repoIDs []int64, keyword string) ([]int64, error)
- func UpdateIssueIndexer(issue *issues_model.Issue)
- func UpdateRepoIndexer(repo *repo_model.Repository)
- type BleveIndexer
- func (b *BleveIndexer) Close()
- func (b *BleveIndexer) Delete(ids ...int64) error
- func (b *BleveIndexer) Index(issues []*IndexerData) error
- func (b *BleveIndexer) Init() (bool, error)
- func (b *BleveIndexer) Ping() bool
- func (b *BleveIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)
- func (b *BleveIndexer) SetAvailabilityChangeCallback(callback func(bool))
- type BleveIndexerData
- type DBIndexer
- func (i *DBIndexer) Close()
- func (i *DBIndexer) Delete(ids ...int64) error
- func (i *DBIndexer) Index(issue []*IndexerData) error
- func (i *DBIndexer) Init() (bool, error)
- func (i *DBIndexer) Ping() bool
- func (i *DBIndexer) Search(ctx context.Context, kw string, repoIDs []int64, limit, start int) (*SearchResult, error)
- func (i *DBIndexer) SetAvailabilityChangeCallback(callback func(bool))
- type ElasticSearchIndexer
- func (b *ElasticSearchIndexer) Close()
- func (b *ElasticSearchIndexer) Delete(ids ...int64) error
- func (b *ElasticSearchIndexer) Index(issues []*IndexerData) error
- func (b *ElasticSearchIndexer) Init() (bool, error)
- func (b *ElasticSearchIndexer) Ping() bool
- func (b *ElasticSearchIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)
- func (b *ElasticSearchIndexer) SetAvailabilityChangeCallback(callback func(bool))
- type Indexer
- type IndexerData
- type Match
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteRepoIssueIndexer ¶
func DeleteRepoIssueIndexer(repo *repo_model.Repository)
DeleteRepoIssueIndexer deletes repo's all issues indexes
func InitIssueIndexer ¶
func InitIssueIndexer(syncReindex bool)
InitIssueIndexer initialize issue indexer, syncReindex is true then reindex until all issue index done.
func IsAvailable ¶ added in v1.17.0
func IsAvailable() bool
IsAvailable checks if issue indexer is available
func SearchIssuesByKeyword ¶
SearchIssuesByKeyword search issue ids by keywords and repo id WARNNING: You have to ensure user have permission to visit repoIDs' issues
func UpdateIssueIndexer ¶
func UpdateIssueIndexer(issue *issues_model.Issue)
UpdateIssueIndexer add/update an issue to the issue indexer
func UpdateRepoIndexer ¶ added in v1.10.2
func UpdateRepoIndexer(repo *repo_model.Repository)
UpdateRepoIndexer add/update all issues of the repositories
Types ¶
type BleveIndexer ¶
type BleveIndexer struct {
// contains filtered or unexported fields
}
BleveIndexer implements Indexer interface
func NewBleveIndexer ¶
func NewBleveIndexer(indexDir string) *BleveIndexer
NewBleveIndexer creates a new bleve local indexer
func (*BleveIndexer) Close ¶ added in v1.11.0
func (b *BleveIndexer) Close()
Close will close the bleve indexer
func (*BleveIndexer) Delete ¶
func (b *BleveIndexer) Delete(ids ...int64) error
Delete deletes indexes by ids
func (*BleveIndexer) Index ¶
func (b *BleveIndexer) Index(issues []*IndexerData) error
Index will save the index data
func (*BleveIndexer) Init ¶
func (b *BleveIndexer) Init() (bool, error)
Init will initialize the indexer
func (*BleveIndexer) Search ¶
func (b *BleveIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)
Search searches for issues by given conditions. Returns the matching issue IDs
func (*BleveIndexer) SetAvailabilityChangeCallback ¶ added in v1.17.0
func (b *BleveIndexer) SetAvailabilityChangeCallback(callback func(bool))
SetAvailabilityChangeCallback does nothing
type BleveIndexerData ¶
type BleveIndexerData IndexerData
BleveIndexerData an update to the issue indexer
func (*BleveIndexerData) Type ¶
func (i *BleveIndexerData) Type() string
Type returns the document type, for bleve's mapping.Classifier interface.
type DBIndexer ¶
type DBIndexer struct{}
DBIndexer implements Indexer interface to use database's like search
func (*DBIndexer) Index ¶
func (i *DBIndexer) Index(issue []*IndexerData) error
Index dummy function
func (*DBIndexer) Search ¶
func (i *DBIndexer) Search(ctx context.Context, kw string, repoIDs []int64, limit, start int) (*SearchResult, error)
Search dummy function
func (*DBIndexer) SetAvailabilityChangeCallback ¶ added in v1.17.0
SetAvailabilityChangeCallback dummy function
type ElasticSearchIndexer ¶ added in v1.12.0
type ElasticSearchIndexer struct {
// contains filtered or unexported fields
}
ElasticSearchIndexer implements Indexer interface
func NewElasticSearchIndexer ¶ added in v1.12.0
func NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, error)
NewElasticSearchIndexer creates a new elasticsearch indexer
func (*ElasticSearchIndexer) Close ¶ added in v1.12.0
func (b *ElasticSearchIndexer) Close()
Close implements indexer
func (*ElasticSearchIndexer) Delete ¶ added in v1.12.0
func (b *ElasticSearchIndexer) Delete(ids ...int64) error
Delete deletes indexes by ids
func (*ElasticSearchIndexer) Index ¶ added in v1.12.0
func (b *ElasticSearchIndexer) Index(issues []*IndexerData) error
Index will save the index data
func (*ElasticSearchIndexer) Init ¶ added in v1.12.0
func (b *ElasticSearchIndexer) Init() (bool, error)
Init will initialize the indexer
func (*ElasticSearchIndexer) Ping ¶ added in v1.17.0
func (b *ElasticSearchIndexer) Ping() bool
Ping checks if elastic is available
func (*ElasticSearchIndexer) Search ¶ added in v1.12.0
func (b *ElasticSearchIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)
Search searches for issues by given conditions. Returns the matching issue IDs
func (*ElasticSearchIndexer) SetAvailabilityChangeCallback ¶ added in v1.17.0
func (b *ElasticSearchIndexer) SetAvailabilityChangeCallback(callback func(bool))
SetAvailabilityChangeCallback sets callback that will be triggered when availability changes
type Indexer ¶
type Indexer interface { Init() (bool, error) Ping() bool SetAvailabilityChangeCallback(callback func(bool)) Index(issue []*IndexerData) error Delete(ids ...int64) error Search(ctx context.Context, kw string, repoIDs []int64, limit, start int) (*SearchResult, error) Close() }
Indexer defines an interface to indexer issues contents
type IndexerData ¶
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"` }
IndexerData data stored in the issue indexer
type SearchResult ¶
SearchResult represents search results