Documentation ¶
Index ¶
- Constants
- Variables
- func FullRefAnalyzer(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error)
- func FullRefTokenizerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Tokenizer, error)
- func GetExt(p string) string
- func PathHierarchyAnalyzer(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error)
- func PathHierarchyTokenizerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Tokenizer, error)
- type BatchMethod
- type BleveIndexer
- func (b *BleveIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
- func (b *BleveIndexer) Count() (uint64, error)
- func (b *BleveIndexer) CreateFileIndex(requestFileIndex FileIndex) error
- func (b *BleveIndexer) DeleteIndexByRefs(organization string, project string, repository string, branches []string, ...) error
- func (b *BleveIndexer) Exists(fileIndex FileIndex) (bool, error)
- func (b *BleveIndexer) SearchQuery(query string, filterParams FilterParams, page int) (SearchResult, error)
- func (b *BleveIndexer) UpsertFileIndex(requestFileIndex FileIndex) error
- type ESIndexer
- func (e *ESIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
- func (e *ESIndexer) Count() (uint64, error)
- func (e *ESIndexer) CreateFileIndex(requestFileIndex FileIndex) error
- func (e *ESIndexer) DeleteIndexByRefs(organization string, project string, repository string, branches []string, ...) error
- func (e *ESIndexer) Exists(requestFileIndex FileIndex) (bool, error)
- func (esi *ESIndexer) Init()
- func (e *ESIndexer) SearchQuery(query string, filterParams FilterParams, page int) (SearchResult, error)
- func (e *ESIndexer) UpsertFileIndex(requestFileIndex FileIndex) error
- type FacetResult
- type FacetResults
- type FileIndex
- type FileIndexOperation
- type FilterParams
- type FullRefTokenizer
- type HighlightSource
- type Hit
- type Indexer
- type Metadata
- type OrganizationFacet
- type PathHierarchyTokenizer
- type ProjectFacet
- type RefFacet
- type RepositoryFacet
- type SearchResult
- type TermFacet
- type TermFacets
Constants ¶
View Source
const NO_EXT = "/noext/"
View Source
const POST_TAG = "\u0001"
View Source
const PRE_TAG = "\u0001"
Variables ¶
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": "keyword",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"fullRefs": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "full_ref",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"organization": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": false,
"include_in_all": false
}],
"default_analyzer": ""
},
"project": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": false,
"include_in_all": false
}],
"default_analyzer": ""
},
"repository": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": false,
"include_in_all": false
}],
"default_analyzer": ""
},
"branches": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": false,
"include_in_all": false
}],
"default_analyzer": ""
},
"tags": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": false,
"include_in_all": false
}],
"default_analyzer": ""
},
"path": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "path_hierarchy",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"ext": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"encoding": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": false
}],
"default_analyzer": ""
},
"size": {
"enabled": true,
"dynamic": true,
"fields": [{
"type": "number",
"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": false,
"index": true,
"include_term_vectors": true,
"include_in_all": true
}],
"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 ¶
func FullRefAnalyzer ¶ added in v0.2.0
func FullRefTokenizerConstructor ¶ added in v0.2.0
func PathHierarchyAnalyzer ¶ added in v0.2.0
Types ¶
type BleveIndexer ¶
type BleveIndexer struct {
// contains filtered or unexported fields
}
func (*BleveIndexer) BatchFileIndex ¶
func (b *BleveIndexer) BatchFileIndex(requestBatch []FileIndexOperation) error
func (*BleveIndexer) Count ¶ added in v0.4.0
func (b *BleveIndexer) Count() (uint64, error)
func (*BleveIndexer) CreateFileIndex ¶
func (b *BleveIndexer) CreateFileIndex(requestFileIndex FileIndex) error
func (*BleveIndexer) DeleteIndexByRefs ¶
func (*BleveIndexer) Exists ¶ added in v0.4.0
func (b *BleveIndexer) Exists(fileIndex FileIndex) (bool, error)
func (*BleveIndexer) SearchQuery ¶
func (b *BleveIndexer) SearchQuery(query string, filterParams FilterParams, page int) (SearchResult, error)
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, filterParams FilterParams, page int) (SearchResult, error)
func (*ESIndexer) UpsertFileIndex ¶
type FacetResult ¶ added in v0.2.0
type FacetResult struct { Field string `json:"field"` Total int `json:"total"` Missing int `json:"missing"` Other int `json:"other"` Terms TermFacets `json:"terms"` }
type FacetResults ¶ added in v0.2.0
type FacetResults map[string]FacetResult
type FileIndex ¶
type FileIndexOperation ¶
type FileIndexOperation struct { Method BatchMethod FileIndex FileIndex }
type FilterParams ¶ added in v0.2.0
type FullRefTokenizer ¶ added in v0.2.0
type FullRefTokenizer struct { }
func (*FullRefTokenizer) Tokenize ¶ added in v0.2.0
func (t *FullRefTokenizer) Tokenize(input []byte) analysis.TokenStream
type HighlightSource ¶
type Hit ¶
type Hit struct { Metadata Keyword []string `json:"keyword"` // 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, branches []string, tags []string) error Count() (uint64, error) SearchQuery(query string, filters FilterParams, page int) (SearchResult, error) Exists(requestFileIndex FileIndex) (bool, error) }
func NewBleveIndexer ¶
func NewBleveIndexer(config *config.Config, reader *repo.GitRepoReader) Indexer
func NewESIndexer ¶
func NewESIndexer(config *config.Config, reader *repo.GitRepoReader) Indexer
type Metadata ¶
type Metadata struct { Blob string `json:"blob"` Organization string `json:"organization"` Project string `json:"project"` Repository string `json:"repository"` Branches []string `json:"branches"` Tags []string `json:"tags"` Path string `json:"path"` Ext string `json:"ext"` Size int64 `json:"size"` Encoding string `json:"encoding"` }
type OrganizationFacet ¶ added in v0.2.0
type OrganizationFacet struct { Term string `json:"term"` Count int `json:"count"` Projects []ProjectFacet `json:"projects"` }
type PathHierarchyTokenizer ¶ added in v0.2.0
type PathHierarchyTokenizer struct { }
func (*PathHierarchyTokenizer) Tokenize ¶ added in v0.2.0
func (t *PathHierarchyTokenizer) Tokenize(input []byte) analysis.TokenStream
type ProjectFacet ¶ added in v0.2.0
type ProjectFacet struct { Term string `json:"term"` Count int `json:"count"` Repositories []RepositoryFacet `json:"repositories"` }
type RepositoryFacet ¶ added in v0.2.0
type SearchResult ¶
type SearchResult struct { Query string `json:"query"` FilterParams FilterParams `json:"filterParams"` Time float64 `json:"time"` Size int64 `json:"size"` Limit int `json:"limit"` Current int `json:"current"` Next int `json:"next"` Hits []Hit `json:"hits"` FullRefsFacet []OrganizationFacet `json:"fullRefsFacet"` Facets FacetResults `json:"facets"` // contains filtered or unexported fields }
type TermFacets ¶ added in v0.2.0
type TermFacets []TermFacet
Click to show internal directories.
Click to hide internal directories.