diff options
author | zeripath <art27@cantab.net> | 2021-04-01 18:41:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 19:41:09 +0200 |
commit | ff460ca74d37b1eadac63b8858d0daa1690e0e2f (patch) | |
tree | 3a04e464fc5e4e6630b31fe4444dd007eb52f799 /modules/indexer | |
parent | 43fb4921e3fb67be9f2f3a6d631a21a3322f492b (diff) | |
download | gitea-ff460ca74d37b1eadac63b8858d0daa1690e0e2f.tar.gz gitea-ff460ca74d37b1eadac63b8858d0daa1690e0e2f.zip |
Speed up `enry.IsVendor` (#15213)
`enry.IsVendor` is kinda slow as it simply iterates across all regexps.
This PR ajdusts the regexps to combine them to make this process a
little quicker.
Related #15143
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/indexer')
-rw-r--r-- | modules/indexer/code/bleve.go | 2 | ||||
-rw-r--r-- | modules/indexer/code/elastic_search.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/indexer/code/bleve.go b/modules/indexer/code/bleve.go index 573ea8b88c..416adeea74 100644 --- a/modules/indexer/code/bleve.go +++ b/modules/indexer/code/bleve.go @@ -178,7 +178,7 @@ func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error) { func (b *BleveIndexer) addUpdate(batchWriter *io.PipeWriter, batchReader *bufio.Reader, commitSha string, update fileUpdate, repo *models.Repository, batch rupture.FlushingBatch) error { // Ignore vendored files in code search - if setting.Indexer.ExcludeVendored && enry.IsVendor(update.Filename) { + if setting.Indexer.ExcludeVendored && analyze.IsVendor(update.Filename) { return nil } diff --git a/modules/indexer/code/elastic_search.go b/modules/indexer/code/elastic_search.go index 5327eb1e51..ebb7910fdc 100644 --- a/modules/indexer/code/elastic_search.go +++ b/modules/indexer/code/elastic_search.go @@ -177,7 +177,7 @@ func (b *ElasticSearchIndexer) init() (bool, error) { func (b *ElasticSearchIndexer) addUpdate(batchWriter *io.PipeWriter, batchReader *bufio.Reader, sha string, update fileUpdate, repo *models.Repository) ([]elastic.BulkableRequest, error) { // Ignore vendored files in code search - if setting.Indexer.ExcludeVendored && enry.IsVendor(update.Filename) { + if setting.Indexer.ExcludeVendored && analyze.IsVendor(update.Filename) { return nil, nil } |