Documentation
¶
Index ¶
- Constants
- Variables
- type BatchMethod
- type BleveIndexer
- func (b *BleveIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
- func (b *BleveIndexer) CreateFileIndex(requestFileIndex FileIndex) error
- func (b *BleveIndexer) DeleteIndexByRefs(organization string, project string, repository string, refs []string) error
- func (b *BleveIndexer) SearchQuery(query string) SearchResult
- func (b *BleveIndexer) UpsertFileIndex(requestFileIndex FileIndex) error
- type ESIndexer
- func (e *ESIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
- func (e *ESIndexer) CreateFileIndex(requestFileIndex FileIndex) error
- func (e *ESIndexer) DeleteIndexByRefs(organization string, project string, repository string, refs []string) error
- func (esi *ESIndexer) Init()
- func (e *ESIndexer) SearchQuery(query string) SearchResult
- func (e *ESIndexer) UpsertFileIndex(requestFileIndex FileIndex) error
- type FileIndex
- type FileIndexOperation
- type HighlightSource
- type Hit
- type Indexer
- type Metadata
- type SearchResult
- type Source
Constants ¶
View Source
const POST_TAG = "\u0001"
View Source
const PRE_TAG = "\u0001"
Variables ¶
View Source
var BLEVE_HIT_TAG = regexp.MustCompile(`<mark>(.*?)</mark>`)
View Source
var CRLF_PATTERN = regexp.MustCompile(`\r?\n|\r`)
View Source
var ES_HIT_TAG = regexp.MustCompile(`\x{0001}(.*?)\x{0001}`)
View Source
var MAPPING = []byte(`{
"types": {
"file": {
"enabled": true,
"dynamic": true,
"properties": {
"blob": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"content": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": true
}],
"default_analyzer": ""
},
"metadata": {
"enabled": true,
"dynamic": true,
"properties": {
"organization": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"project": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"repository": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"refs": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"path": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"ext": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "en",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
}
},
"default_analyzer": ""
}
},
"default_analyzer": ""
}
},
"default_mapping": {
"enabled": true,
"dynamic": true,
"default_analyzer": ""
},
"type_field": "_type",
"default_type": "file",
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"store_dynamic": true,
"index_dynamic": true,
"analysis": {}
}`)
Functions ¶
This section is empty.
Types ¶
type BleveIndexer ¶
type BleveIndexer struct {
// contains filtered or unexported fields
}
func (*BleveIndexer) BatchFileIndex ¶
func (b *BleveIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
func (*BleveIndexer) CreateFileIndex ¶
func (b *BleveIndexer) CreateFileIndex(requestFileIndex FileIndex) error
func (*BleveIndexer) DeleteIndexByRefs ¶
func (*BleveIndexer) SearchQuery ¶
func (b *BleveIndexer) SearchQuery(query string) SearchResult
func (*BleveIndexer) UpsertFileIndex ¶
func (b *BleveIndexer) UpsertFileIndex(requestFileIndex FileIndex) error
type ESIndexer ¶
type ESIndexer struct {
// contains filtered or unexported fields
}
func (*ESIndexer) BatchFileIndex ¶
func (e *ESIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
func (*ESIndexer) CreateFileIndex ¶
func (*ESIndexer) DeleteIndexByRefs ¶
func (*ESIndexer) SearchQuery ¶
func (e *ESIndexer) SearchQuery(query string) SearchResult
func (*ESIndexer) UpsertFileIndex ¶
type FileIndex ¶
type FileIndexOperation ¶
type FileIndexOperation struct {
Method BatchMethod
FileIndex FileIndex
}
type HighlightSource ¶
type Hit ¶
type Hit struct {
Source Source `json:"_source"`
// Highlight map[string][]string `json:"highlight"`
Preview []util.TextPreview `json:"preview"`
}
type Indexer ¶
type Indexer interface {
CreateFileIndex(requestFileIndex FileIndex) error
UpsertFileIndex(requestFileIndex FileIndex) error
BatchFileIndex(operations []FileIndexOperation) error
DeleteIndexByRefs(organization string, project string, repository string, refs []string) error
SearchQuery(query string) SearchResult
}
func NewBleveIndexer ¶
func NewBleveIndexer(config config.Config, reader *repo.GitRepoReader) Indexer
func NewESIndexer ¶
func NewESIndexer(config config.Config, reader *repo.GitRepoReader) Indexer
type SearchResult ¶
Click to show internal directories.
Click to hide internal directories.