{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package issues\n\n## Functions\n\n```go\nfunc DeleteRepoIssueIndexer(repo *models.Repository)\n```\nDeleteRepoIssueIndexer deletes repo's all issues indexes\n\n```go\nfunc InitIssueIndexer(syncReindex bool) error\n```\nInitIssueIndexer initialize issue indexer, syncReindex is true then reindex until all issue index done.\n\n```go\nfunc SearchIssuesByKeyword(repoID int64, keyword string) ([]int64, error)\n```\nSearchIssuesByKeyword search issue ids by keywords and repo id\n\n```go\nfunc UpdateIssueIndexer(issue *models.Issue)\n```\nUpdateIssueIndexer add/update an issue to the issue indexer\n\n## Types\n\n```go\ntype BleveIndexer struct {\n\t// contains filtered or unexported fields\n}\n```\nBleveIndexer implements Indexer interface\n\n```go\nfunc NewBleveIndexer(indexDir string) *BleveIndexer\n```\nNewBleveIndexer creates a new bleve local indexer\n\n```go\nfunc (b *BleveIndexer) Delete(ids ...int64) error\n```\nDelete deletes indexes by ids\n\n```go\nfunc (b *BleveIndexer) Index(issues []*IndexerData) error\n```\nIndex will save the index data\n\n```go\nfunc (b *BleveIndexer) Init() (bool, error)\n```\nInit will initial the indexer\n\n```go\nfunc (b *BleveIndexer) Search(keyword string, repoID int64, limit, start int) (*SearchResult, error)\n```\nSearch searches for issues by given conditions. Returns the matching issue IDs\n\n```go\ntype BleveIndexerData IndexerData\n```\nBleveIndexerData an update to the issue indexer\n\n```go\nfunc (i *BleveIndexerData) Type() string\n```\nType returns the document type, for bleve's mapping.Classifier interface.\n\n```go\ntype ChannelQueue struct {\n\t// contains filtered or unexported fields\n}\n```\nChannelQueue implements\n\n```go\nfunc NewChannelQueue(indexer Indexer, batchNumber int) *ChannelQueue\n```\nNewChannelQueue create a memory channel queue\n\n```go\nfunc (c *ChannelQueue) Push(data *IndexerData) error\n```\nPush will push the indexer data to queue\n\n```go\nfunc (c *ChannelQueue) Run() error\n```\nRun starts to run the queue\n\n```go\ntype DBIndexer struct {\n}\n```\nDBIndexer implements Indexer inteface to use database's like search\n\n```go\nfunc (db *DBIndexer) Delete(ids ...int64) error\n```\nDelete dummy function\n\n```go\nfunc (db *DBIndexer) Index(issue []*IndexerData) error\n```\nIndex dummy function\n\n```go\nfunc (db *DBIndexer) Init() (bool, error)\n```\nInit dummy function\n\n```go\nfunc (db *DBIndexer) Search(kw string, repoID int64, limit, start int) (*SearchResult, error)\n```\nSearch dummy function\n\n```go\ntype DummyQueue struct {\n}\n```\nDummyQueue represents an empty queue\n\n```go\nfunc (b *DummyQueue) Push(*IndexerData) error\n```\nPush pushes data to indexer\n\n```go\nfunc (b *DummyQueue) Run() error\n```\nRun starts to run the queue\n\n```go\ntype Indexer interface {\n\tInit() (bool, error)\n\tIndex(issue []*IndexerData) error\n\tDelete(ids ...int64) error\n\tSearch(kw string, repoID int64, limit, start int) (*SearchResult, error)\n}\n```\nIndexer defines an inteface to indexer issues contents\n\n```go\ntype IndexerData struct {\n\tID       int64\n\tRepoID   int64\n\tTitle    string\n\tContent  string\n\tComments []string\n\tIsDelete bool\n\tIDs      []int64\n}\n```\nIndexerData data stored in the issue indexer\n\n```go\ntype LevelQueue struct {\n\t// contains filtered or unexported fields\n}\n```\nLevelQueue implements a disk library queue\n\n```go\nfunc NewLevelQueue(indexer Indexer, dataDir string, batchNumber int) (*LevelQueue, error)\n```\nNewLevelQueue creates a ledis local queue\n\n```go\nfunc (l *LevelQueue) Push(data *IndexerData) error\n```\nPush will push the indexer data to queue\n\n```go\nfunc (l *LevelQueue) Run() error\n```\nRun starts to run the queue\n\n```go\ntype Match struct {\n\tID     int64   `json:\"id\"`\n\tRepoID int64   `json:\"repo_id\"`\n\tScore  float64 `json:\"score\"`\n}\n```\nMatch represents on search result\n\n```go\ntype Queue interface {\n\tRun() error\n\tPush(*IndexerData) error\n}\n```\nQueue defines an interface to save an issue indexer queue\n\n```go\ntype SearchResult struct {\n\tTotal int64\n\tHits  []Match\n}\n```\nSearchResult represents search results\n\n","path":"github.com/RedAFD/code-core/modules/indexer/issues","name":"issues","synopsis":"","isRedistributable":true}
