gitea: code.gitea.io/gitea/modules/indexer/code Index | Files

package code

import "code.gitea.io/gitea/modules/indexer/code"

Index

Package Files

bleve.go elastic_search.go git.go indexer.go search.go wrapped.go

Variables

var ErrWrappedIndexerClosed = fmt.Errorf("Indexer closed before ready")

ErrWrappedIndexerClosed is the error returned if the indexer was closed before it was ready

func DeleteRepoFromIndexer Uses

func DeleteRepoFromIndexer(repo *models.Repository)

DeleteRepoFromIndexer remove all of a repository's entries from the indexer

func Init Uses

func Init()

Init initialize the repo indexer

func PerformSearch Uses

func PerformSearch(repoIDs []int64, language, keyword string, page, pageSize int) (int, []*Result, []*SearchResultLanguages, error)

PerformSearch perform a search on a repository

func UpdateRepoIndexer Uses

func UpdateRepoIndexer(repo *models.Repository)

UpdateRepoIndexer update a repository's entries in the indexer

type BleveIndexer Uses

type BleveIndexer struct {
    // contains filtered or unexported fields
}

BleveIndexer represents a bleve indexer implementation

func NewBleveIndexer Uses

func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error)

NewBleveIndexer creates a new bleve local indexer

func (*BleveIndexer) Close Uses

func (b *BleveIndexer) Close()

Close close the indexer

func (*BleveIndexer) Delete Uses

func (b *BleveIndexer) Delete(repoID int64) error

Delete deletes indexes by ids

func (*BleveIndexer) Index Uses

func (b *BleveIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error

Index indexes the data

func (*BleveIndexer) Search Uses

func (b *BleveIndexer) Search(repoIDs []int64, language, keyword string, page, pageSize int) (int64, []*SearchResult, []*SearchResultLanguages, error)

Search searches for files in the specified repo. Returns the matching file-paths

type ElasticSearchIndexer Uses

type ElasticSearchIndexer struct {
    // contains filtered or unexported fields
}

ElasticSearchIndexer implements Indexer interface

func NewElasticSearchIndexer Uses

func NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, bool, error)

NewElasticSearchIndexer creates a new elasticsearch indexer

func (*ElasticSearchIndexer) Close Uses

func (b *ElasticSearchIndexer) Close()

Close implements indexer

func (*ElasticSearchIndexer) Delete Uses

func (b *ElasticSearchIndexer) Delete(repoID int64) error

Delete deletes indexes by ids

func (*ElasticSearchIndexer) Index Uses

func (b *ElasticSearchIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error

Index will save the index data

func (*ElasticSearchIndexer) Search Uses

func (b *ElasticSearchIndexer) Search(repoIDs []int64, language, keyword string, page, pageSize int) (int64, []*SearchResult, []*SearchResultLanguages, error)

Search searches for codes and language stats by given conditions.

type Indexer Uses

type Indexer interface {
    Index(repo *models.Repository, sha string, changes *repoChanges) error
    Delete(repoID int64) error
    Search(repoIDs []int64, language, keyword string, page, pageSize int) (int64, []*SearchResult, []*SearchResultLanguages, error)
    Close()
}

Indexer defines an interface to index and search code contents

type IndexerData Uses

type IndexerData struct {
    RepoID   int64
    IsDelete bool
}

IndexerData represents data stored in the code indexer

type RepoIndexerData Uses

type RepoIndexerData struct {
    RepoID    int64
    CommitID  string
    Content   string
    Language  string
    UpdatedAt time.Time
}

RepoIndexerData data stored in the repo indexer

func (*RepoIndexerData) Type Uses

func (d *RepoIndexerData) Type() string

Type returns the document type, for bleve's mapping.Classifier interface.

type Result Uses

type Result struct {
    RepoID         int64
    Filename       string
    CommitID       string
    UpdatedUnix    timeutil.TimeStamp
    Language       string
    Color          string
    LineNumbers    []int
    FormattedLines string
}

Result a search result to display

type SearchResult Uses

type SearchResult struct {
    RepoID      int64
    StartIndex  int
    EndIndex    int
    Filename    string
    Content     string
    CommitID    string
    UpdatedUnix timeutil.TimeStamp
    Language    string
    Color       string
}

SearchResult result of performing a search in a repo

type SearchResultLanguages Uses

type SearchResultLanguages struct {
    Language string
    Color    string
    Count    int
}

SearchResultLanguages result of top languages count in search results

Package code imports 33 packages (graph) and is imported by 15 packages. Updated 2021-01-22. Refresh now. Tools for package owners.