{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package code\n\n## Variables\n\n```go\nvar ErrWrappedIndexerClosed = fmt.Errorf(\"Indexer closed before ready\")\n```\nErrWrappedIndexerClosed is the error returned if the indexer was closed before it was ready\n\n## Functions\n\n```go\nfunc DeleteRepoFromIndexer(repo *models.Repository)\n```\nDeleteRepoFromIndexer remove all of a repository's entries from the indexer\n\n```go\nfunc Init()\n```\nInit initialize the repo indexer\n\n```go\nfunc PerformSearch(repoIDs []int64, language, keyword string, page, pageSize int, isMatch bool) (int, []*Result, []*SearchResultLanguages, error)\n```\nPerformSearch perform a search on a repository\n\n```go\nfunc UpdateRepoIndexer(repo *models.Repository)\n```\nUpdateRepoIndexer update a repository's entries in the indexer\n\n## Types\n\n```go\ntype BleveIndexer struct {\n\t// contains filtered or unexported fields\n}\n```\nBleveIndexer represents a bleve indexer implementation\n\n```go\nfunc NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error)\n```\nNewBleveIndexer creates a new bleve local indexer\n\n```go\nfunc (b *BleveIndexer) Close()\n```\nClose close the indexer\n\n```go\nfunc (b *BleveIndexer) Delete(repoID int64) error\n```\nDelete deletes indexes by ids\n\n```go\nfunc (b *BleveIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error\n```\nIndex indexes the data\n\n```go\nfunc (b *BleveIndexer) Search(repoIDs []int64, language, keyword string, page, pageSize int, isMatch bool) (int64, []*SearchResult, []*SearchResultLanguages, error)\n```\nSearch searches for files in the specified repo. Returns the matching file-paths\n\n```go\ntype ElasticSearchIndexer struct {\n\t// contains filtered or unexported fields\n}\n```\nElasticSearchIndexer implements Indexer interface\n\n```go\nfunc NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, bool, error)\n```\nNewElasticSearchIndexer creates a new elasticsearch indexer\n\n```go\nfunc (b *ElasticSearchIndexer) Close()\n```\nClose implements indexer\n\n```go\nfunc (b *ElasticSearchIndexer) Delete(repoID int64) error\n```\nDelete deletes indexes by ids\n\n```go\nfunc (b *ElasticSearchIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error\n```\nIndex will save the index data\n\n```go\nfunc (b *ElasticSearchIndexer) Search(repoIDs []int64, language, keyword string, page, pageSize int, isMatch bool) (int64, []*SearchResult, []*SearchResultLanguages, error)\n```\nSearch searches for codes and language stats by given conditions.\n\n```go\ntype Indexer interface {\n\tIndex(repo *models.Repository, sha string, changes *repoChanges) error\n\tDelete(repoID int64) error\n\tSearch(repoIDs []int64, language, keyword string, page, pageSize int, isMatch bool) (int64, []*SearchResult, []*SearchResultLanguages, error)\n\tClose()\n}\n```\nIndexer defines an interface to index and search code contents\n\n```go\ntype IndexerData struct {\n\tRepoID   int64\n\tIsDelete bool\n}\n```\nIndexerData represents data stored in the code indexer\n\n```go\ntype RepoIndexerData struct {\n\tRepoID    int64\n\tCommitID  string\n\tContent   string\n\tLanguage  string\n\tUpdatedAt time.Time\n}\n```\nRepoIndexerData data stored in the repo indexer\n\n```go\nfunc (d *RepoIndexerData) Type() string\n```\nType returns the document type, for bleve's mapping.Classifier interface.\n\n```go\ntype Result struct {\n\tRepoID         int64\n\tFilename       string\n\tCommitID       string\n\tUpdatedUnix    timeutil.TimeStamp\n\tLanguage       string\n\tColor          string\n\tLineNumbers    []int\n\tFormattedLines string\n}\n```\nResult a search result to display\n\n```go\ntype SearchResult struct {\n\tRepoID      int64\n\tStartIndex  int\n\tEndIndex    int\n\tFilename    string\n\tContent     string\n\tCommitID    string\n\tUpdatedUnix timeutil.TimeStamp\n\tLanguage    string\n\tColor       string\n}\n```\nSearchResult result of performing a search in a repo\n\n```go\ntype SearchResultLanguages struct {\n\tLanguage string\n\tColor    string\n\tCount    int\n}\n```\nSearchResultLanguages result of top languages count in search results\n\n","path":"github.com/RedAFD/code-core/modules/indexer/code","name":"code","synopsis":"","isRedistributable":true}
