Documentation
¶
Index ¶
- Constants
- type EngineOptions
- type IndexedDocument
- func (z *IndexedDocument) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *IndexedDocument) EncodeMsg(en *msgp.Writer) (err error)
- func (z *IndexedDocument) MarshalBinary() (data []byte, err error)
- func (z *IndexedDocument) MarshalMsg(b []byte) (o []byte, err error)
- func (z *IndexedDocument) Msgsize() (s int)
- func (z *IndexedDocument) UnmarshalBinary(data []byte) error
- func (z *IndexedDocument) UnmarshalMsg(bts []byte) (o []byte, err error)
- type IndexerOptions
- type ScoredDocument
- type ScoredDocuments
- type SearchOptions
- type SearchRequest
- type SearchResponse
Constants ¶
View Source
const ( STANDARD //传统计算方法 MEITUAN //美团开放计算方法 IMPROVED //优化的计算方法 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EngineOptions ¶
type EngineOptions struct {
NumShards int //channel分片
AddBuffer int //add channel长度
RemoveBuffer int //remove channel长度
SearchBuffer int //channel长度
SearchWorkerThreads int //每个搜索channel worker数量
DefaultSearchOption *SearchOptions //默认搜索配置
IndexerOption *IndexerOptions //索引器配置项
}
func (*EngineOptions) Init ¶
func (o *EngineOptions) Init()
type IndexedDocument ¶
type IndexedDocument struct {
DocId uint64 `msg:"id"`
Latitude float64 `msg:"lat"`
Longitude float64 `msg:"long"`
Fields interface{} `msg:"f"`
}
固态存储中存储的struct
func (*IndexedDocument) DecodeMsg ¶
func (z *IndexedDocument) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*IndexedDocument) EncodeMsg ¶
func (z *IndexedDocument) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*IndexedDocument) MarshalBinary ¶
func (z *IndexedDocument) MarshalBinary() (data []byte, err error)
marshal
func (*IndexedDocument) MarshalMsg ¶
func (z *IndexedDocument) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*IndexedDocument) Msgsize ¶
func (z *IndexedDocument) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*IndexedDocument) UnmarshalBinary ¶
func (z *IndexedDocument) UnmarshalBinary(data []byte) error
unmarshal
func (*IndexedDocument) UnmarshalMsg ¶
func (z *IndexedDocument) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type IndexerOptions ¶
type ScoredDocument ¶
排序的struct
type ScoredDocuments ¶
type ScoredDocuments []*ScoredDocument
排序
func (ScoredDocuments) Len ¶
func (docs ScoredDocuments) Len() int
func (ScoredDocuments) Less ¶
func (docs ScoredDocuments) Less(i, j int) bool
func (ScoredDocuments) Swap ¶
func (docs ScoredDocuments) Swap(i, j int)
type SearchOptions ¶
type SearchOptions struct {
Refresh bool
OrderDesc bool
Timeout time.Duration
Accuracy int //计算进度
Circles int //圈数,默认1,不扩散
Excepts map[uint64]bool //排除指定ID
Filter func(doc IndexedDocument) bool
}
可不设置的搜索参数
func (*SearchOptions) Init ¶
func (o *SearchOptions) Init()
type SearchRequest ¶
type SearchRequest struct {
Latitude float64
Longitude float64
CountOnly bool
Offset int
Limit int
SearchOption *SearchOptions //可留空,使用引擎默认参数
}
搜索请求
type SearchResponse ¶
type SearchResponse struct {
Docs ScoredDocuments //排序好的结果
Timeout bool //是否超时
Count int //数量
}
搜索结果返回
Click to show internal directories.
Click to hide internal directories.