issues

package
v1.14.0-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRepoIssueIndexer

func DeleteRepoIssueIndexer(repo *models.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 SearchIssuesByKeyword

func SearchIssuesByKeyword(repoIDs []int64, keyword string) ([]int64, error)

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 *models.Issue)

UpdateIssueIndexer add/update an issue to the issue indexer

func UpdateRepoIndexer

func UpdateRepoIndexer(repo *models.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

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(keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)

Search searches for issues by given conditions. Returns the matching issue IDs

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) Close

func (db *DBIndexer) Close()

Close dummy function

func (*DBIndexer) Delete

func (db *DBIndexer) Delete(ids ...int64) error

Delete dummy function

func (*DBIndexer) Index

func (db *DBIndexer) Index(issue []*IndexerData) error

Index dummy function

func (*DBIndexer) Init

func (db *DBIndexer) Init() (bool, error)

Init dummy function

func (*DBIndexer) Search

func (db *DBIndexer) Search(kw string, repoIDs []int64, limit, start int) (*SearchResult, error)

Search dummy function

type ElasticSearchIndexer

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

ElasticSearchIndexer implements Indexer interface

func NewElasticSearchIndexer

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

NewElasticSearchIndexer creates a new elasticsearch indexer

func (*ElasticSearchIndexer) Close

func (b *ElasticSearchIndexer) Close()

Close implements indexer

func (*ElasticSearchIndexer) Delete

func (b *ElasticSearchIndexer) Delete(ids ...int64) error

Delete deletes indexes by ids

func (*ElasticSearchIndexer) Index

func (b *ElasticSearchIndexer) Index(issues []*IndexerData) error

Index will save the index data

func (*ElasticSearchIndexer) Init

func (b *ElasticSearchIndexer) Init() (bool, error)

Init will initialize the indexer

func (*ElasticSearchIndexer) Search

func (b *ElasticSearchIndexer) Search(keyword string, repoIDs []int64, limit, start int) (*SearchResult, error)

Search searches for issues by given conditions. Returns the matching issue IDs

type Indexer

type Indexer interface {
	Init() (bool, error)
	Index(issue []*IndexerData) error
	Delete(ids ...int64) error
	Search(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 Match

type Match struct {
	ID    int64   `json:"id"`
	Score float64 `json:"score"`
}

Match represents on search result

type SearchResult

type SearchResult struct {
	Total int64
	Hits  []Match
}

SearchResult represents search results

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL