// LikeText sets the text to use in order to find documents that are "like" this.
513914
func (q *MoreLikeThisQuery) LikeText(likeTexts ...string) *MoreLikeThisQuery {
	for _, s := range likeTexts {
		item := NewMoreLikeThisQueryItem().LikeText(s)
		q.docs = append(q.docs, item)
	}
	return q
}
558485
func (b ValExprBuilder) Like(val interface{}) BoolExprBuilder {
	return b.makeComparisonExpr(astLike, makeValExpr(val))
}
473450
func (s *Block) SetText(v string) *Block {
	s.Text = &v
	return s
}
1277074
func (s *Search) MoreLikeThis(parser MltResultParser) (*SolrMltResult, error) {
	resp, err := s.Resource("mlt", s.QueryParams())
	if err != nil {
		return nil, err
	}
	if parser == nil {
		parser = new(MoreLikeThisParser)
	}
	return parser.Parse(resp)
}
868423
func LikeCompare(a, b string) (value.BoolValue, bool) {
	// Do we want to always do this replacement?   Or do this at parse time or config?
	if strings.Contains(b, "%") {
		b = strings.Replace(b, "%", "*", -1)
	}
	match, err := glob.Match(b, a)
	if err != nil {
		return value.BoolValueFalse, false
	}
	if match {
		return value.BoolValueTrue, true
	}
	return value.BoolValueFalse, true
}
1168635
func (s *CallInstructionsMessageType) SetText(v string) *CallInstructionsMessageType {
	s.Text = &v
	return s
}
561150
func (s *DetectKeyPhrasesInput) SetText(v string) *DetectKeyPhrasesInput {
	s.Text = &v
	return s
}
788861
func (s *Note) SetText(v string) *Note {
	s.Text = &v
	return s
}
264052
func FindText(input *html.Node) (data string) {
	var buffer string
	for c := input.FirstChild; c != nil; c = c.NextSibling {
		if c.Parent.DataAtom == input.DataAtom && c.Type == html.TextNode {
			buffer = strings.TrimSpace(c.Data)
			if len(buffer) > 0 {
				data += " " + buffer
			}
		}
		FindText(c)
	}
	return strings.TrimSpace(data)
}
115866
func (s *CreateCommentInput) SetText(v string) *CreateCommentInput {
	s.Text = &v
	return s
}
385824
func (s *Selection) SetText(text string) *Selection {
	return s.SetHtml(html.EscapeString(text))
}
425554
func (s *Comment) SetText(v string) *Comment {
	s.Text = &v
	return s
}
534583
func (c *ClickTrackingSetting) SetEnableText(enableText bool) *ClickTrackingSetting {
	setEnable := enableText
	c.EnableText = &setEnable
	return c
}
220660
func (as *Step) ClearText() bool {
	if len(as.Text) == 0 {
		return false
	}
	as.Text = nil
	return true
}
945425
func (q *MoreLikeThisQuery) Source() (interface{}, error) {
	// {
	//   "match_all" : { ... }
	// }
	if len(q.docs) == 0 {
		return nil, errors.New(`more_like_this requires some documents to be "liked"`)
	}

	source := make(map[string]interface{})

	params := make(map[string]interface{})
	source["more_like_this"] = params

	if len(q.fields) > 0 {
		params["fields"] = q.fields
	}

	var likes []interface{}
	for _, doc := range q.docs {
		src, err := doc.Source()
		if err != nil {
			return nil, err
		}
		likes = append(likes, src)
	}
	params["like"] = likes

	if len(q.unlikeDocs) > 0 {
		var dontLikes []interface{}
		for _, doc := range q.unlikeDocs {
			src, err := doc.Source()
			if err != nil {
				return nil, err
			}
			dontLikes = append(dontLikes, src)
		}
		params["unlike"] = dontLikes
	}

	if q.minimumShouldMatch != "" {
		params["minimum_should_match"] = q.minimumShouldMatch
	}
	if q.minTermFreq != nil {
		params["min_term_freq"] = *q.minTermFreq
	}
	if q.maxQueryTerms != nil {
		params["max_query_terms"] = *q.maxQueryTerms
	}
	if len(q.stopWords) > 0 {
		params["stop_words"] = q.stopWords
	}
	if q.minDocFreq != nil {
		params["min_doc_freq"] = *q.minDocFreq
	}
	if q.maxDocFreq != nil {
		params["max_doc_freq"] = *q.maxDocFreq
	}
	if q.minWordLength != nil {
		params["min_word_length"] = *q.minWordLength
	}
	if q.maxWordLength != nil {
		params["max_word_length"] = *q.maxWordLength
	}
	if q.boostTerms != nil {
		params["boost_terms"] = *q.boostTerms
	}
	if q.boost != nil {
		params["boost"] = *q.boost
	}
	if q.analyzer != "" {
		params["analyzer"] = q.analyzer
	}
	if q.failOnUnsupportedField != nil {
		params["fail_on_unsupported_field"] = *q.failOnUnsupportedField
	}
	if q.queryName != "" {
		params["_name"] = q.queryName
	}
	if q.include != nil {
		params["include"] = *q.include
	}

	return source, nil
}
8433
func (w *standardSMLWriter) Text(text string) error {
	var buf bytes.Buffer
	for _, r := range text {
		switch r {
		case '^':
			buf.WriteString("^^")
		case '{':
			buf.WriteString("^{")
		case '}':
			buf.WriteString("^}")
		default:
			buf.WriteRune(r)
		}
	}
	return w.context.Writef(buf.String())
}
1032429
func (self *Context) GetText() string {
	if self.text == nil {
		self.initText()
	}
	return util.Bytes2String(self.text)
}