more rank debugging

This commit is contained in:
Todd Gruben 2014-04-17 13:43:52 -05:00
parent 5c35df5b7d
commit b321136a41
2 changed files with 5 additions and 4 deletions

View file

@ -48,7 +48,7 @@ func NewService() *Service {
service.WebService = NewWebService(service)
service.Index = index.NewFragmentContainer()
service.Hold = hold.NewHolder()
service.version = "0.0.21"
service.version = "0.0.22"
service.name = "Cruncher"
service.PrepareLogging()
fmt.Printf("Pilosa %s\n", service.version)

View file

@ -85,7 +85,7 @@ func (self *Brand) cache_it(bm IBitmap, bitmap_id uint64, category uint64) {
if bm.Count() >= self.threshold_value {
self.bitmap_cache[bitmap_id] = &Rank{&Pair{bitmap_id, bm.Count()}, bm, category}
if len(self.bitmap_cache) > self.threshold_length {
log.Printf("RANK: %d %d", len(self.bitmap_cache), self.threshold_length)
log.Printf("RANK: %d %d %d", len(self.bitmap_cache), self.threshold_length, self.threshold_value)
self.Rank()
self.trim()
}
@ -93,10 +93,11 @@ func (self *Brand) cache_it(bm IBitmap, bitmap_id uint64, category uint64) {
}
func (self *Brand) trim() {
for k, item := range self.bitmap_cache {
if item.bitmap.Count() < self.threshold_value {
if item.bitmap.Count() <= self.threshold_value {
delete(self.bitmap_cache, k)
}
}
log.Printf("TRIM: %d %d", len(self.bitmap_cache), self.threshold_length)
}
@ -134,7 +135,7 @@ func (self *Brand) Rank() {
item := list[self.threshold_idx]
self.threshold_value = item.bitmap.Count()
} else {
self.threshold_value = 0
self.threshold_value = 1
}
//dump(self.rankings, 10)