Esempio n. 1
0
// Simplified and altered page rank
func WeightTags(s *session.Session) {

	s.IncrementState()

	tags := s.GetHashtagCursor()
	goodWeight := 1.0 / s.GetHashtagSize(true)
	badWeight := -1.0 / s.GetHashtagSize(false)

	for {
		key, err := tags.Next(nil)
		if err != nil {
			log.Println(err)
			break // No further entities match the query.
		}
		hashtag := s.Hashtag(key.StringID())

		log.Println(hashtag.Name)

		processTags(s, goodWeight, hashtag.Beneficiaries)
		processTags(s, badWeight, hashtag.Victims)
	}

	s.SetTopTags()

	// Move on
	s.IncrementStep()
	s.StopProcessing()
}