Back to godoc.org

Package search

v1.0.6
Latest Go to latest

The highest tagged major version is .

Published: Oct 31, 2016 | License: Apache-2.0 | Module: github.com/Dataman-Cloud/crane

Index

Constants

const (
	DOCUMENT_NODE    = "node"
	DOCUMENT_STACK   = "stack"
	DOCUMENT_SERVICE = "service"
	DOCUMENT_TASK    = "task"
	DOCUMENT_NETWORK = "network"
	DOCUMENT_VOLUME  = "volume"
)
const (
	//Search
	CodeInvalidSearchKeywords = "503-13001"
)
const (
	RESULT_LEN = 10
)
const SEARCH_LOAD_DATA_INTERVAL = 1

func Init

func Init()

type CraneIndexer

type CraneIndexer struct {
	Indexer

	CraneDockerClient *dockerclient.CraneDockerClient
}

func NewCraneIndex

func NewCraneIndex(CraneDockerClient *dockerclient.CraneDockerClient) *CraneIndexer

func (*CraneIndexer) Index

func (indexer *CraneIndexer) Index(store *DocumentStorage)

type Document

type Document struct {
	ID      string
	Name    string
	Type    string
	GroupId uint64 `json:"-"`
	Param   map[string]string
}

type DocumentStorage

type DocumentStorage struct {
	Store map[string]Document
}

func NewDocumentStorage

func NewDocumentStorage() *DocumentStorage

func (*DocumentStorage) Copy

func (storage *DocumentStorage) Copy() *DocumentStorage

func (*DocumentStorage) Empty

func (storage *DocumentStorage) Empty()

func (*DocumentStorage) Get

func (storage *DocumentStorage) Get(key string) *Document

func (*DocumentStorage) Indices

func (storage *DocumentStorage) Indices() []string

func (*DocumentStorage) Set

func (storage *DocumentStorage) Set(key string, doc Document)

type Indexer

type Indexer interface {
	Index(prefetchStore *DocumentStorage)
}

type SearchApi

type SearchApi struct {
	Index         []string
	Store         *DocumentStorage
	PrefetchStore *DocumentStorage

	Indexer Indexer
}

func (*SearchApi) ApiRegister

func (searchApi *SearchApi) ApiRegister(router *gin.Engine, middlewares ...gin.HandlerFunc)

func (*SearchApi) IndexData

func (searchApi *SearchApi) IndexData()

func (*SearchApi) Search

func (searchApi *SearchApi) Search(ctx *gin.Context)

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier