mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
cat initialization issue
This commit is contained in:
parent
7cc7159165
commit
d8ceef1b0a
3 changed files with 24 additions and 12 deletions
|
|
@ -33,7 +33,7 @@ func (self *Service) CountQueryStepHandler(msg *db.Message) {
|
|||
func (self *Service) TopNQueryStepHandler(msg *db.Message) {
|
||||
//spew.Dump("TOP-N QUERYSTEP")
|
||||
qs := msg.Data.(query.TopNQueryStep)
|
||||
spew.Dump(qs)
|
||||
//spew.Dump(qs)
|
||||
//TRAVIS SEE HERE
|
||||
//need categories in qs I just added so it would compile
|
||||
var categoryleaves []uint64
|
||||
|
|
|
|||
|
|
@ -35,26 +35,30 @@ type IntSet struct {
|
|||
}
|
||||
|
||||
func NewIntSet() *IntSet {
|
||||
return &IntSet{make(map[uint64]bool)}
|
||||
x := new(IntSet)
|
||||
x.set = make(map[uint64]bool)
|
||||
x.set[0] = true
|
||||
log.Println(x.set)
|
||||
return x
|
||||
}
|
||||
|
||||
func (set *IntSet) Add(i uint64) bool {
|
||||
_, found := set.set[i]
|
||||
set.set[i] = true
|
||||
func (self *IntSet) Add(i uint64) bool {
|
||||
_, found := self.set[i]
|
||||
self.set[i] = true
|
||||
return !found //False if it existed already
|
||||
}
|
||||
|
||||
func (set *IntSet) Contains(i uint64) bool {
|
||||
_, found := set.set[i]
|
||||
func (self *IntSet) Contains(i uint64) bool {
|
||||
_, found := self.set[i]
|
||||
return found //true if it existed already
|
||||
}
|
||||
|
||||
func (set *IntSet) Remove(i uint64) {
|
||||
delete(set.set, i)
|
||||
func (self *IntSet) Remove(i uint64) {
|
||||
delete(self.set, i)
|
||||
}
|
||||
|
||||
func (set *IntSet) Size() int {
|
||||
return len(set.set)
|
||||
func (self *IntSet) Size() int {
|
||||
return len(self.set)
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ func (self *Brand) SetBit(bitmap_id uint64, bit_pos uint64, filter uint64) bool
|
|||
}
|
||||
|
||||
func (self *Brand) Rank() {
|
||||
log.Println("RANK")
|
||||
if self.rank_counter <= 0 {
|
||||
self.rank_counter = self.skip
|
||||
} else {
|
||||
|
|
@ -126,6 +127,7 @@ func (self *Brand) Rank() {
|
|||
} else {
|
||||
self.threshold_value = 0
|
||||
}
|
||||
log.Println("RANK DONE")
|
||||
}
|
||||
|
||||
func packagePairs(r RankList) []Pair {
|
||||
|
|
@ -173,10 +175,16 @@ func (self *Brand) Store(bitmap_id uint64, bm IBitmap, filter uint64) {
|
|||
func (self *Brand) TopN(src_bitmap IBitmap, n int, categories []uint64) []Pair {
|
||||
self.rank_counter = 0
|
||||
self.Rank() // TODO: TERRIBLE REMOVE THIS ASAP
|
||||
is := new(IntSet)
|
||||
is := NewIntSet()
|
||||
log.Println("ok")
|
||||
|
||||
for _, v := range categories {
|
||||
log.Println(is)
|
||||
log.Println(v)
|
||||
is.Add(v)
|
||||
|
||||
}
|
||||
log.Println("more")
|
||||
return self.TopNCat(src_bitmap, n, is)
|
||||
}
|
||||
func dump(r RankList, n int) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue