Documentation ¶
Index ¶
- Variables
- func Abs(val float32) float32
- func CandidateIsLess(r1, r2 DocScore) bool
- func CheckIntersection(yValue float32, p1, p2 CustomPoint, insideMin, insideMax *float32)
- func CloseWriters(db *FsScoreDb) error
- func ComputeCustomFunc(x float32, points []CustomPoint) float32
- func EnsureDirectory(dir string) error
- func Exists(path string) bool
- func FileIsAtEnd(file *os.File) bool
- func Max(v1, v2 float32) float32
- func MaxDocsForFile(fileInfo *FileInfo) int64
- func Min(v1, v2 float32) float32
- func Pow(val, exp float32) float32
- func QueryFloatVal(queryParams url.Values, key string, defaultValue float32) (float32, error)
- func QueryIntVal(queryParams url.Values, key string, defaultValue int) (int, error)
- func ReadNativeLong(buf []byte) uint64
- func RunBenchmark(db LinearCombinationBackend, csvFilename string, maxRecords int64) ([]int64, []int64, [][]int64, error)
- func RunItr(itr DocItr, myWorkerNum int, resultChannel chan CandidateResult, ...)
- func ServeHttp(addr string, db Db, readOnly bool) error
- func ShardIdToExt(idInShard int64, shardNum int) int64
- func ToFloat32(val interface{}) (float32, error)
- func WriteNativeLong(val uint64, writer io.Writer) error
- func WritePostingListEntry(fileInfo *FileInfo, docId int64, score float32)
- type BaseDb
- type BaseDbResultSet
- type BaseStreamingDb
- type BitReader
- type BitWriter
- type BoltIdDb
- type Bounds
- type CandidateResult
- type CustomLinearDocItr
- func (op *CustomLinearDocItr) Close()
- func (op *CustomLinearDocItr) Cur() (int64, float32)
- func (op *CustomLinearDocItr) GetBounds() (min, max float32)
- func (op *CustomLinearDocItr) Name() string
- func (op *CustomLinearDocItr) Next(minId int64) bool
- func (op *CustomLinearDocItr) SetBounds(outsideMin, outsideMax float32) bool
- type CustomMapDocItr
- func (op *CustomMapDocItr) Close()
- func (op *CustomMapDocItr) ComputeCustomFunc(val float32) float32
- func (op *CustomMapDocItr) Cur() (int64, float32)
- func (op *CustomMapDocItr) GetBounds() (min, max float32)
- func (op *CustomMapDocItr) Name() string
- func (op *CustomMapDocItr) Next(minId int64) bool
- func (op *CustomMapDocItr) SetBounds(outsideMin, outsideMax float32) bool
- type CustomPoint
- type Db
- type DbBackend
- type DiffDocItr
- type DocItr
- type DocScore
- type EsQueryResponse
- type EsScoreDb
- func (db *EsScoreDb) BulkIndex(records []Record) error
- func (db *EsScoreDb) CreateIndex()
- func (db *EsScoreDb) DeleteIndex()
- func (db *EsScoreDb) LinearQuery(numResults int, weights map[string]float32) []string
- func (db *EsScoreDb) ParseQuery(query string) map[string]float32
- func (db *EsScoreDb) RefreshIndex()
- type FieldDocItr
- type FieldDocItrs
- type FileInfo
- type FsScoreDb
- type IdBackend
- type LinearCombinationBackend
- type MemoryDocItr
- type MemoryIdDb
- type MemoryScoreDb
- type MemoryScoreDocItr
- func (op *MemoryScoreDocItr) Close()
- func (op *MemoryScoreDocItr) Cur() (int64, float32)
- func (op *MemoryScoreDocItr) GetBounds() (min, max float32)
- func (op *MemoryScoreDocItr) Name() string
- func (op *MemoryScoreDocItr) Next(minId int64) bool
- func (op *MemoryScoreDocItr) SetBounds(min, max float32) bool
- type MigratableDb
- type MinComponents
- type MinDocItr
- type OrderedFileInfos
- type ParallelDocItr
- type PostingListDocItr
- func (op *PostingListDocItr) Close()
- func (op *PostingListDocItr) Cur() (int64, float32)
- func (op *PostingListDocItr) GetBounds() (min, max float32)
- func (op *PostingListDocItr) Name() string
- func (op *PostingListDocItr) Next(minId int64) bool
- func (op *PostingListDocItr) SetBounds(min, max float32) bool
- type PostingListHeader
- type PowDocItr
- type ProductComponents
- type ProductDocItr
- type Query
- type QueryResult
- type Record
- type ScaleDocItr
- type ScoreDbServer
- type ShardedDb
- type StreamingDb
- type StubDb
- type SumComponent
- type SumComponents
- type SumDocItr
Constants ¶
This section is empty.
Variables ¶
View Source
var HEADER_SIZE = int64(binary.Size(PostingListHeader{}))
View Source
var INITIAL_VAR_BITS = uint(23 - 0)
View Source
var NegativeInfinity = float32(math.Inf(-1))
View Source
var PositiveInfinity = float32(math.Inf(1))
Functions ¶
func CandidateIsLess ¶
func CheckIntersection ¶
func CheckIntersection(yValue float32, p1, p2 CustomPoint, insideMin, insideMax *float32)
func CloseWriters ¶
func ComputeCustomFunc ¶
func ComputeCustomFunc(x float32, points []CustomPoint) float32
func EnsureDirectory ¶
func FileIsAtEnd ¶
func MaxDocsForFile ¶
func QueryFloatVal ¶
func QueryIntVal ¶
func ReadNativeLong ¶
func RunBenchmark ¶
func RunItr ¶
func RunItr(itr DocItr, myWorkerNum int, resultChannel chan CandidateResult, boundsChannel chan Bounds)
func ShardIdToExt ¶
func WritePostingListEntry ¶
Types ¶
type BaseDb ¶
type BaseDb struct { StreamingDb StreamingDb IdDb IdBackend }
func (BaseDb) LinearQuery ¶
type BaseDbResultSet ¶
type BaseDbResultSet []DocScore
func (BaseDbResultSet) Len ¶
func (h BaseDbResultSet) Len() int
func (BaseDbResultSet) Less ¶
func (h BaseDbResultSet) Less(i, j int) bool
func (*BaseDbResultSet) Pop ¶
func (h *BaseDbResultSet) Pop() interface{}
func (*BaseDbResultSet) Push ¶
func (h *BaseDbResultSet) Push(x interface{})
func (BaseDbResultSet) Swap ¶
func (h BaseDbResultSet) Swap(i, j int)
type BaseStreamingDb ¶
type BaseStreamingDb struct {
Backend DbBackend
}
func (BaseStreamingDb) BulkIndex ¶
func (db BaseStreamingDb) BulkIndex(records []map[string]float32) ([]int64, error)
func (BaseStreamingDb) QueryItr ¶
func (db BaseStreamingDb) QueryItr(scorer []interface{}) (DocItr, error)
type BitReader ¶
type BitReader struct { OrigMmap *mmap.MMap Mmap []uint64 MmapPtr uint MmapPtrBitsLeft uint File *os.File Cur uint64 CurBitsLeft uint }
func (*BitReader) ReadVarUInt32 ¶
type BitWriter ¶
func (*BitWriter) WriteVarUInt32 ¶
type BoltIdDb ¶
func NewBoltIdDb ¶
type CandidateResult ¶
type CustomLinearDocItr ¶
type CustomLinearDocItr struct {
// contains filtered or unexported fields
}
Remaps a value according to a user-specified function that linearly interpolates among a set of (x, y) points.
func (*CustomLinearDocItr) Close ¶
func (op *CustomLinearDocItr) Close()
func (*CustomLinearDocItr) Cur ¶
func (op *CustomLinearDocItr) Cur() (int64, float32)
func (*CustomLinearDocItr) GetBounds ¶
func (op *CustomLinearDocItr) GetBounds() (min, max float32)
func (*CustomLinearDocItr) Name ¶
func (op *CustomLinearDocItr) Name() string
func (*CustomLinearDocItr) Next ¶
func (op *CustomLinearDocItr) Next(minId int64) bool
func (*CustomLinearDocItr) SetBounds ¶
func (op *CustomLinearDocItr) SetBounds(outsideMin, outsideMax float32) bool
type CustomMapDocItr ¶
type CustomMapDocItr struct {
// contains filtered or unexported fields
}
Remaps a value according to a user-specified mapping of values to scores
func (*CustomMapDocItr) Close ¶
func (op *CustomMapDocItr) Close()
func (*CustomMapDocItr) ComputeCustomFunc ¶
func (op *CustomMapDocItr) ComputeCustomFunc(val float32) float32
func (*CustomMapDocItr) Cur ¶
func (op *CustomMapDocItr) Cur() (int64, float32)
func (*CustomMapDocItr) GetBounds ¶
func (op *CustomMapDocItr) GetBounds() (min, max float32)
func (*CustomMapDocItr) Name ¶
func (op *CustomMapDocItr) Name() string
func (*CustomMapDocItr) Next ¶
func (op *CustomMapDocItr) Next(minId int64) bool
func (*CustomMapDocItr) SetBounds ¶
func (op *CustomMapDocItr) SetBounds(outsideMin, outsideMax float32) bool
type CustomPoint ¶
type CustomPoint struct {
X, Y float32
}
func ToXyPoints ¶
func ToXyPoints(input interface{}) ([]CustomPoint, error)
type DiffDocItr ¶
type DiffDocItr struct {
// contains filtered or unexported fields
}
(Absolute) difference between a value and a constant
func (*DiffDocItr) Close ¶
func (op *DiffDocItr) Close()
func (*DiffDocItr) Cur ¶
func (op *DiffDocItr) Cur() (int64, float32)
func (*DiffDocItr) GetBounds ¶
func (op *DiffDocItr) GetBounds() (min, max float32)
func (*DiffDocItr) Name ¶
func (op *DiffDocItr) Name() string
func (*DiffDocItr) Next ¶
func (op *DiffDocItr) Next(minId int64) bool
func (*DiffDocItr) SetBounds ¶
func (op *DiffDocItr) SetBounds(min, max float32) bool
type DocItr ¶
type DocItr interface { Name() string // return false if the iterator is now known to not produce any more values SetBounds(min, max float32) bool GetBounds() (min, max float32) // Next() skips the iterator ahead to at least as far as the given id. // It always advances the iterator at least one position. // It Returns false if there are no remaining values. // Iterators need a call to Next(0) to intialize them to a real value; they all initially have a docId of -1 Next(minId int64) bool Close() // release resources held by this iterator (if any) Cur() (int64, float32) // doc id and score of current result, or (-1, 0.0) if the iterator has not been initialized }
func NewPostingListDocItr ¶
func NewPostingListDocItr(rangePrefix uint32, path string, header *PostingListHeader, numVarBits uint) DocItr
type EsQueryResponse ¶
type EsQueryResponse struct { Hits struct { Hits []struct { Id string `json:"_id"` } `json:"hits"` } `json:"hits"` }
type EsScoreDb ¶
type EsScoreDb struct {
BaseURL, Index string
}
func (*EsScoreDb) CreateIndex ¶
func (db *EsScoreDb) CreateIndex()
func (*EsScoreDb) DeleteIndex ¶
func (db *EsScoreDb) DeleteIndex()
func (*EsScoreDb) LinearQuery ¶
func (*EsScoreDb) RefreshIndex ¶
func (db *EsScoreDb) RefreshIndex()
type FieldDocItr ¶
type FieldDocItr struct {
// contains filtered or unexported fields
}
func NewFieldDocItr ¶
func NewFieldDocItr(field string, lists FieldDocItrs) *FieldDocItr
func (*FieldDocItr) Close ¶
func (op *FieldDocItr) Close()
func (*FieldDocItr) Cur ¶
func (op *FieldDocItr) Cur() (int64, float32)
func (*FieldDocItr) GetBounds ¶
func (op *FieldDocItr) GetBounds() (min, max float32)
func (*FieldDocItr) Name ¶
func (op *FieldDocItr) Name() string
func (*FieldDocItr) Next ¶
func (op *FieldDocItr) Next(minId int64) bool
func (*FieldDocItr) SetBounds ¶
func (op *FieldDocItr) SetBounds(min, max float32) bool
type FieldDocItrs ¶
type FieldDocItrs []DocItr // FieldDocItrs implements heap.Interface
func (FieldDocItrs) Len ¶
func (so FieldDocItrs) Len() int
func (FieldDocItrs) Less ¶
func (so FieldDocItrs) Less(i, j int) bool
func (*FieldDocItrs) Pop ¶
func (so *FieldDocItrs) Pop() interface{}
func (*FieldDocItrs) Push ¶
func (so *FieldDocItrs) Push(x interface{})
func (FieldDocItrs) Swap ¶
func (so FieldDocItrs) Swap(i, j int)
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
type FsScoreDb ¶
type FsScoreDb struct {
// contains filtered or unexported fields
}
func NewFsScoreDb ¶
func (*FsScoreDb) FieldDocItr ¶
type MemoryDocItr ¶
type MemoryDocItr struct {
// contains filtered or unexported fields
}
func NewMemoryDocItr ¶
func NewMemoryDocItr(scores []float32, docs []int64) *MemoryDocItr
func (*MemoryDocItr) Close ¶
func (op *MemoryDocItr) Close()
func (*MemoryDocItr) Cur ¶
func (op *MemoryDocItr) Cur() (int64, float32)
func (*MemoryDocItr) GetBounds ¶
func (op *MemoryDocItr) GetBounds() (min, max float32)
func (*MemoryDocItr) Name ¶
func (op *MemoryDocItr) Name() string
func (*MemoryDocItr) Next ¶
func (op *MemoryDocItr) Next(minId int64) bool
func (*MemoryDocItr) SetBounds ¶
func (op *MemoryDocItr) SetBounds(min, max float32) bool
type MemoryIdDb ¶
type MemoryIdDb struct {
// contains filtered or unexported fields
}
func NewMemoryIdDb ¶
func NewMemoryIdDb() MemoryIdDb
type MemoryScoreDb ¶
func NewMemoryScoreDb ¶
func NewMemoryScoreDb() *MemoryScoreDb
func (*MemoryScoreDb) BulkIndex ¶
func (db *MemoryScoreDb) BulkIndex(records []map[string]float32) ([]int64, error)
func (*MemoryScoreDb) FieldDocItr ¶
func (db *MemoryScoreDb) FieldDocItr(fieldName string) DocItr
type MemoryScoreDocItr ¶
type MemoryScoreDocItr struct {
// contains filtered or unexported fields
}
func NewMemoryScoreDocItr ¶
func NewMemoryScoreDocItr(scores []float32) *MemoryScoreDocItr
func (*MemoryScoreDocItr) Close ¶
func (op *MemoryScoreDocItr) Close()
func (*MemoryScoreDocItr) Cur ¶
func (op *MemoryScoreDocItr) Cur() (int64, float32)
func (*MemoryScoreDocItr) GetBounds ¶
func (op *MemoryScoreDocItr) GetBounds() (min, max float32)
func (*MemoryScoreDocItr) Name ¶
func (op *MemoryScoreDocItr) Name() string
func (*MemoryScoreDocItr) Next ¶
func (op *MemoryScoreDocItr) Next(minId int64) bool
func (*MemoryScoreDocItr) SetBounds ¶
func (op *MemoryScoreDocItr) SetBounds(min, max float32) bool
type MigratableDb ¶
type MigratableDb struct {
Current Db
}
func (*MigratableDb) BulkIndex ¶
func (db *MigratableDb) BulkIndex(records []Record) error
func (*MigratableDb) Index ¶
func (db *MigratableDb) Index(id string, values map[string]float32) error
func (*MigratableDb) Query ¶
func (db *MigratableDb) Query(query Query) (QueryResult, error)
type MinComponents ¶
type MinComponents []DocItr
func (MinComponents) Len ¶
func (a MinComponents) Len() int
func (MinComponents) Less ¶
func (a MinComponents) Less(i, j int) bool
func (MinComponents) Swap ¶
func (a MinComponents) Swap(i, j int)
type MinDocItr ¶
type MinDocItr struct {
// contains filtered or unexported fields
}
func NewMinDocItr ¶
type OrderedFileInfos ¶
type OrderedFileInfos []*FileInfo
func (OrderedFileInfos) Len ¶
func (a OrderedFileInfos) Len() int
func (OrderedFileInfos) Less ¶
func (a OrderedFileInfos) Less(i, j int) bool
func (OrderedFileInfos) Swap ¶
func (a OrderedFileInfos) Swap(i, j int)
type ParallelDocItr ¶
type ParallelDocItr struct { NumAlive int Bounds Bounds ResultChannel chan CandidateResult Comms []chan Bounds // contains filtered or unexported fields }
func NewParallelDocItr ¶
func NewParallelDocItr(parts []DocItr) *ParallelDocItr
func (*ParallelDocItr) Close ¶
func (op *ParallelDocItr) Close()
func (*ParallelDocItr) Cur ¶
func (op *ParallelDocItr) Cur() (int64, float32)
func (*ParallelDocItr) GetBounds ¶
func (op *ParallelDocItr) GetBounds() (min, max float32)
func (*ParallelDocItr) Name ¶
func (op *ParallelDocItr) Name() string
func (*ParallelDocItr) Next ¶
func (op *ParallelDocItr) Next(minId int64) bool
func (*ParallelDocItr) SetBounds ¶
func (op *ParallelDocItr) SetBounds(min, max float32) bool
type PostingListDocItr ¶
type PostingListDocItr struct {
// contains filtered or unexported fields
}
func (*PostingListDocItr) Close ¶
func (op *PostingListDocItr) Close()
func (*PostingListDocItr) Cur ¶
func (op *PostingListDocItr) Cur() (int64, float32)
func (*PostingListDocItr) GetBounds ¶
func (op *PostingListDocItr) GetBounds() (min, max float32)
func (*PostingListDocItr) Name ¶
func (op *PostingListDocItr) Name() string
func (*PostingListDocItr) Next ¶
func (op *PostingListDocItr) Next(minId int64) bool
func (*PostingListDocItr) SetBounds ¶
func (op *PostingListDocItr) SetBounds(min, max float32) bool
type PostingListHeader ¶
type PowDocItr ¶
type PowDocItr struct {
// contains filtered or unexported fields
}
Takes a constant power of a value. Important: for bounds caluclation reasons, assumes only positive values are provided as inputs!
func NewPowDocItr ¶
type ProductComponents ¶
type ProductComponents []DocItr
func (ProductComponents) Len ¶
func (a ProductComponents) Len() int
func (ProductComponents) Less ¶
func (a ProductComponents) Less(i, j int) bool
func (ProductComponents) Swap ¶
func (a ProductComponents) Swap(i, j int)
type ProductDocItr ¶
type ProductDocItr struct {
// contains filtered or unexported fields
}
func NewProductDocItr ¶
func NewProductDocItr(itrs []DocItr) *ProductDocItr
func (*ProductDocItr) Close ¶
func (op *ProductDocItr) Close()
func (*ProductDocItr) Cur ¶
func (op *ProductDocItr) Cur() (int64, float32)
func (*ProductDocItr) GetBounds ¶
func (op *ProductDocItr) GetBounds() (min, max float32)
func (*ProductDocItr) Name ¶
func (op *ProductDocItr) Name() string
func (*ProductDocItr) Next ¶
func (op *ProductDocItr) Next(minId int64) bool
func (*ProductDocItr) SetBounds ¶
func (op *ProductDocItr) SetBounds(min, max float32) bool
type QueryResult ¶
type ScaleDocItr ¶
type ScaleDocItr struct {
// contains filtered or unexported fields
}
Multiplies a value by a constant
func (*ScaleDocItr) Close ¶
func (op *ScaleDocItr) Close()
func (*ScaleDocItr) Cur ¶
func (op *ScaleDocItr) Cur() (int64, float32)
func (*ScaleDocItr) GetBounds ¶
func (op *ScaleDocItr) GetBounds() (min, max float32)
func (*ScaleDocItr) Name ¶
func (op *ScaleDocItr) Name() string
func (*ScaleDocItr) Next ¶
func (op *ScaleDocItr) Next(minId int64) bool
func (*ScaleDocItr) SetBounds ¶
func (op *ScaleDocItr) SetBounds(min, max float32) bool
type ScoreDbServer ¶
func (*ScoreDbServer) ServeHTTP ¶
func (sds *ScoreDbServer) ServeHTTP(w http.ResponseWriter, req *http.Request)
type ShardedDb ¶
type ShardedDb struct {
Shards []StreamingDb
}
func NewShardedDb ¶
func NewShardedDb(shards []StreamingDb) (*ShardedDb, error)
type StreamingDb ¶
type StubDb ¶
type StubDb struct {
// contains filtered or unexported fields
}
func (*StubDb) LinearQuery ¶
type SumComponent ¶
type SumComponent struct {
// contains filtered or unexported fields
}
type SumComponents ¶
type SumComponents []SumComponent
func (SumComponents) Len ¶
func (a SumComponents) Len() int
func (SumComponents) Less ¶
func (a SumComponents) Less(i, j int) bool
func (SumComponents) Swap ¶
func (a SumComponents) Swap(i, j int)
type SumDocItr ¶
type SumDocItr struct {
// contains filtered or unexported fields
}
func NewSumDocItr ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.