issues

package
v1.9.0-dev Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 19 Imported by: 0

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

InitIssueIndexer initialize issue indexer, syncReindex is true then reindex until all issue index done.

func SearchIssuesByKeyword

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

SearchIssuesByKeyword search issue ids by keywords and repo id

func UpdateIssueIndexer

func UpdateIssueIndexer(issue *models.Issue)

UpdateIssueIndexer add/update an issue to the issue indexer

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) 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 initial the indexer

func (*BleveIndexer) Search

func (b *BleveIndexer) Search(keyword string, repoID 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 ChannelQueue

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

ChannelQueue implements

func NewChannelQueue

func NewChannelQueue(indexer Indexer, batchNumber int) *ChannelQueue

NewChannelQueue create a memory channel queue

func (*ChannelQueue) Push

func (c *ChannelQueue) Push(data *IndexerData) error

Push will push the indexer data to queue

func (*ChannelQueue) Run

func (c *ChannelQueue) Run() error

Run starts to run the queue

type DBIndexer

type DBIndexer struct {
}

DBIndexer implements Indexer inteface to use database's like search

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, repoID int64, limit, start int) (*SearchResult, error)

Search dummy function

type DummyQueue

type DummyQueue struct {
}

DummyQueue represents an empty queue

func (*DummyQueue) Push

func (b *DummyQueue) Push(*IndexerData) error

Push pushes data to indexer

func (*DummyQueue) Run

func (b *DummyQueue) Run() error

Run starts to run the queue

type Indexer

type Indexer interface {
	Init() (bool, error)
	Index(issue []*IndexerData) error
	Delete(ids ...int64) error
	Search(kw string, repoID int64, limit, start int) (*SearchResult, error)
}

Indexer defines an inteface to indexer issues contents

type IndexerData

type IndexerData struct {
	ID       int64
	RepoID   int64
	Title    string
	Content  string
	Comments []string
	IsDelete bool
	IDs      []int64
}

IndexerData data stored in the issue indexer

type LevelQueue

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

LevelQueue implements a disk library queue

func NewLevelQueue

func NewLevelQueue(indexer Indexer, dataDir string, batchNumber int) (*LevelQueue, error)

NewLevelQueue creates a ledis local queue

func (*LevelQueue) Push

func (l *LevelQueue) Push(data *IndexerData) error

Push will push the indexer data to queue

func (*LevelQueue) Run

func (l *LevelQueue) Run() error

Run starts to run the queue

type Match

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

Match represents on search result

type Queue

type Queue interface {
	Run() error
	Push(*IndexerData) error
}

Queue defines an interface to save an issue indexer queue

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