// TotalHits is a convenience function to return the number of hits for
// a search result. The return value might not be accurate, unless
// track_total_hits parameter has set to true.
762709
func (r *SearchResult) TotalHits() int64 {
	if r.Hits != nil && r.Hits.TotalHits != nil {
		return r.Hits.TotalHits.Value
	}
	return 0
}
346733
func (h *Client) NonInteractionHit(nonInteractionHit bool) *Client {
	h.nonInteractionHit = nonInteractionHit
	h.nonInteractionHitSet = true
	return h
}
676547
func (r *SearchRequest) TrackScores(trackScores bool) *SearchRequest {
	r.searchSource = r.searchSource.TrackScores(trackScores)
	return r
}
1163975
func (s *DeleteByQueryService) TrackScores(trackScores bool) *DeleteByQueryService {
	s.trackScores = &trackScores
	return s
}
810983
func (s *ListHITsForQualificationTypeOutput) SetHITs(v []*HIT) *ListHITsForQualificationTypeOutput {
	s.HITs = v
	return s
}
648539
func (a *AlgorithmDefault) WeightingHits(
	wordID int,
	rank *Rank,
) float32 {
	weight := rank.Words[wordID].Qty

	return float32(weight)
}
533340
func (t *TabletTracker) Track(stats []discovery.TabletStats) *topodatapb.Tablet {
	if len(stats) == 0 {
		panic("stats must not be empty")
	}
	t.mu.Lock()
	defer t.mu.Unlock()

	// Try to find a tablet which is not in use yet.
	for _, stat := range stats {
		key := topoproto.TabletAliasString(stat.Tablet.Alias)
		if _, ok := t.usedTablets[key]; !ok {
			t.usedTablets[key] = 1
			return stat.Tablet
		}
	}

	// If we reached this point, "stats" is a subset of "usedTablets" i.e.
	// all tablets are already in use. Take the least used one.
	for _, aliasString := range t.tabletsByUsage() {
		for _, stat := range stats {
			key := topoproto.TabletAliasString(stat.Tablet.Alias)
			if key == aliasString {
				t.usedTablets[key]++
				return stat.Tablet
			}
		}
	}
	panic("BUG: we did not add any tablet")
}
624963
func (s *sticky) AllCacheHits() uint64 {
	var total uint64
	for _, cache := range s.metricCache {
		total += cache.allCacheHits()
	}
	return total
}
101807
func (c *Client) TorrentStopHashes(hashes []string) (err error) {
	if err = c.rpcCall("torrent-stop", &torrentActionHashesParam{IDs: hashes}, nil); err != nil {
		err = fmt.Errorf("'torrent-stop' rpc method failed: %v", err)
	}
	return
}
427076
func countSpentOutputs(block *btcutil.Block) int {
	// Exclude the coinbase transaction since it can't spend anything.
	var numSpent int
	for _, tx := range block.Transactions()[1:] {
		numSpent += len(tx.MsgTx().TxIn)
	}
	return numSpent
}
1317175
func (f *Freq) Hits() int {
	f.RLock()
	defer f.RUnlock()
	return f.hits
}
836688
func (c *CommitsSearchResult) GetTotal() int {
	if c == nil || c.Total == nil {
		return 0
	}
	return *c.Total
}
462401
func (api chartApi) GetTopTracks(args map[string]interface{}) (result ChartGetTopTracks, err error) {
	defer func() { appendCaller(err, "lastfm.Chart.GetTopTracks") }()
	err = callGet("chart.gettoptracks", api.params, args, &result, P{
		"plain": []string{"page", "limit"},
	})
	return
}
179500
func (g *GistStats) GetTotalGists() int {
	if g == nil || g.TotalGists == nil {
		return 0
	}
	return *g.TotalGists
}
549506
func (cb *configBased) AllCacheHits() uint64 {
	var total uint64
	for _, cache := range cb.metricCache {
		total += cache.allCacheHits()
	}
	return total
}
967626
func (a *AlgorithmChain) WeightingHits(
	wordID int,
	rank *Rank,
) float32 {
	word := rank.Words[wordID]
	qty := 0

	for leftWordID, leftWordQty := range word.ConnectionLeft {
		qty += rank.Words[leftWordID].Qty * leftWordQty
	}

	for rightWordID, rightWordQty := range word.ConnectionRight {
		qty += rank.Words[rightWordID].Qty * rightWordQty
	}

	weight := float32(word.Qty) + (float32(qty))

	return float32(weight)
}
616812
func (s *UpdateByQueryService) TrackScores(trackScores bool) *UpdateByQueryService {
	s.trackScores = &trackScores
	return s
}