// InnerHit sets the inner hit definition in the scope of this query and
// reusing the defined type and query.
548699
func (q *ParentIdQuery) InnerHit(innerHit *InnerHit) *ParentIdQuery {
	q.innerHit = innerHit
	return q
}
585876
func (s *SearchOutput) SetHits(v *Hits) *SearchOutput {
	s.Hits = v
	return s
}
35943
func GetInnerInvalidParamsError(err error) error {
	for err != nil {
		if _, ok := err.(invalidParamsError); ok {
			return InnerError(err)
		}
		err = InnerError(err)
	}
	return nil
}
55403
func (c *ScanCursor) TotalHits() int64 {
	if c.Results.Hits == nil {
		return 0
	}
	return c.Results.Hits.TotalHits
}
267542
func (ai *AtomicInt) CompareAndSet(expect int, update int) bool {
	res := atomic.CompareAndSwapInt64(&ai.val, int64(expect), int64(update))
	return res
}
554952
func (m *Response) MembershipAt(i int) (*PeerMembershipResult, *Error) {
	r := m.Results[i]
	return r.GetMembers(), r.GetError()
}
534617
func (e *Errors) Crit(format string, a ...interface{}) error {
	return e.add(Critical, format, a...)
}
546959
func (s *ListReviewableHITsInput) SetHITTypeId(v string) *ListReviewableHITsInput {
	s.HITTypeId = &v
	return s
}
25907
func (b *Builder) InnerJoin(joinTable string, joinCond interface{}) *Builder {
	return b.Join("INNER", joinTable, joinCond)
}
150412
func (p *BlockPrefetchClient) Hits() uint64 {
	p.Lock()
	defer p.Unlock()
	return p.hits
}
1153023
func (s *GetHITOutput) SetHIT(v *HIT) *GetHITOutput {
	s.HIT = v
	return s
}
679286
func (cb *configBased) CacheHits(ns string, version int, id string) (uint64, error) {
	if cache, ok := cb.metricCache[id]; ok {
		return cache.cacheHits(ns, version)
	}
	return 0, ErrCacheDoesNotExist
}
1126333
func (self *Context) initText() {
	var err error

	// 采用surf内核下载时，尝试自动转码
	if self.Request.DownloaderID == request.SURF_ID {
		var contentType, pageEncode string
		// 优先从响应头读取编码类型
		contentType = self.Response.Header.Get("Content-Type")
		if _, params, err := mime.ParseMediaType(contentType); err == nil {
			if cs, ok := params["charset"]; ok {
				pageEncode = strings.ToLower(strings.TrimSpace(cs))
			}
		}
		// 响应头未指定编码类型时，从请求头读取
		if len(pageEncode) == 0 {
			contentType = self.Request.Header.Get("Content-Type")
			if _, params, err := mime.ParseMediaType(contentType); err == nil {
				if cs, ok := params["charset"]; ok {
					pageEncode = strings.ToLower(strings.TrimSpace(cs))
				}
			}
		}

		switch pageEncode {
		// 不做转码处理
		case "utf8", "utf-8", "unicode-1-1-utf-8":
		default:
			// 指定了编码类型，但不是utf8时，自动转码为utf8
			// get converter to utf-8
			// Charset auto determine. Use golang.org/x/net/html/charset. Get response body and change it to utf-8
			var destReader io.Reader

			if len(pageEncode) == 0 {
				destReader, err = charset.NewReader(self.Response.Body, "")
			} else {
				destReader, err = charset.NewReaderLabel(pageEncode, self.Response.Body)
			}

			if err == nil {
				self.text, err = ioutil.ReadAll(destReader)
				if err == nil {
					self.Response.Body.Close()
					return
				} else {
					logs.Log.Warning(" *     [convert][%v]: %v (ignore transcoding)\n", self.GetUrl(), err)
				}
			} else {
				logs.Log.Warning(" *     [convert][%v]: %v (ignore transcoding)\n", self.GetUrl(), err)
			}
		}
	}

	// 不做转码处理
	self.text, err = ioutil.ReadAll(self.Response.Body)
	self.Response.Body.Close()
	if err != nil {
		panic(err.Error())
		return
	}

}
476539
func InnerCommand(c cmd.Command) cmd.Command {
	for {
		c1, ok := c.(wrapper)
		if !ok {
			return c
		}
		c = c1.inner()
	}
}
1145805
func (rs *ResultSet) StringAt(index int) (string, error) {
	value, err := rs.ValueAt(index)
	if err != nil {
		return "", err
	}
	return value.String(), nil
}
951960
func flatten(key string, value interface{}, vars map[string]string) {
	switch value.(type) {
	case string:
		log.Debug("setting key %s to: %s", key, value)
		vars[key] = value.(string)
	case map[string]interface{}:
		inner := value.(map[string]interface{})
		for innerKey, innerValue := range inner {
			innerKey = path.Join(key, "/", innerKey)
			flatten(innerKey, innerValue, vars)
		}
	default: // we don't know how to handle non string or maps of strings
		log.Warning("type of '%s' is not supported (%T)", key, value)
	}
}
164920
func (mir MutateInResult) ContentAt(idx int, valuePtr interface{}) error {
	return mir.contents[idx].as(valuePtr)
}