// MaxDocFreq sets the maximum frequency for which words may still appear.
// Words that appear in more than this many docs will be ignored.
// It defaults to unbounded.
540924
func (q MoreLikeThisQuery) MaxDocFreq(maxDocFreq int) MoreLikeThisQuery {
	q.maxDocFreq = &maxDocFreq
	return q
}
25484
func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *TermRangeQuery {
	return &TermRangeQuery{
		Min:          min,
		Max:          max,
		InclusiveMin: minInclusive,
		InclusiveMax: maxInclusive,
	}
}
52834
func (fs *TermvectorsFilterSettings) MinDocFreq(value int64) *TermvectorsFilterSettings {
	fs.minDocFreq = &value
	return fs
}
1073324
func (c *DefaultIndexingChain) fillStoredFields(docId int) (err error) {
	for err == nil && c.lastStoredDocId < docId {
		err = c.startStoredFields()
		if err == nil {
			err = c.finishStoredFields()
		}
	}
	return
}
1209498
func (f *Fuzzer) MaxDepth(d int) *Fuzzer {
	f.maxDepth = d
	return f
}
752553
func ReadDocValueBoundary(chunk int, metaHeaders []MetaData) (uint64, uint64) {
	var start uint64
	if chunk > 0 {
		start = metaHeaders[chunk-1].DocDvOffset
	}
	return start, metaHeaders[chunk].DocDvOffset
}
961295
func NewListPaperDocsResponse(DocIds []string, Cursor *Cursor, HasMore bool) *ListPaperDocsResponse {
	s := new(ListPaperDocsResponse)
	s.DocIds = DocIds
	s.Cursor = Cursor
	s.HasMore = HasMore
	return s
}
676888
func (fs *TermvectorsFilterSettings) MaxTermFreq(value int64) *TermvectorsFilterSettings {
	fs.maxTermFreq = &value
	return fs
}
103304
func (f *FreqDist) cumulativeFrequencies(Samples []string) []int {
	cf := make([]int, 0, len(f.Samples))

	for _, val := range Samples {
		cf = append(cf, f.Samples[val])
	}

	return cf
}
1089446
func (c *Corpus) IDFreq(id int) int {
	size := atomic.LoadInt64(&c.maxid)
	maxid := int(size)

	if id >= maxid {
		return 0
	}
	return c.frequencies[id]
}
752886
func (q MoreLikeThisQuery) MinDocFreq(minDocFreq int) MoreLikeThisQuery {
	q.minDocFreq = &minDocFreq
	return q
}
1011656
func (fs *TermvectorsFilterSettings) Source() (interface{}, error) {
	source := make(map[string]interface{})
	if fs.maxNumTerms != nil {
		source["max_num_terms"] = *fs.maxNumTerms
	}
	if fs.minTermFreq != nil {
		source["min_term_freq"] = *fs.minTermFreq
	}
	if fs.maxTermFreq != nil {
		source["max_term_freq"] = *fs.maxTermFreq
	}
	if fs.minDocFreq != nil {
		source["min_doc_freq"] = *fs.minDocFreq
	}
	if fs.maxDocFreq != nil {
		source["max_doc_freq"] = *fs.maxDocFreq
	}
	if fs.minWordLength != nil {
		source["min_word_length"] = *fs.minWordLength
	}
	if fs.maxWordLength != nil {
		source["max_word_length"] = *fs.maxWordLength
	}
	return source, nil
}
941157
func (l *Limiter) GetMax() float64 {
	l.RLock()
	defer l.RUnlock()
	return l.max
}
513016
func NewDoc(content interface{}) *Context {
    c := &Context {
        Names: make(map[string]int),
    }

    switch t := content.(type) {
    case string:
        if t == "" {
            c.List = nil
        } else {
            c.List = [][]byte{[]byte(t)}
        }
    case []byte:
        if t == nil {
            c.List = nil
        } else {
            c.List = [][]byte{t}
        }
    default: 
        // panic?
        // panic("invalid doc")
    }

    return c
}
985321
func (col *Collection) ForEachDoc(fun func(id int, doc []byte) bool) {
	for id := 0; id < col.Used-DocHeader && id >= 0; {
		validity := col.Buf[id]
		room, _ := binary.Varint(col.Buf[id+1 : id+11])
		docEnd := id + DocHeader + int(room)
		if (validity == 0 || validity == 1) && room <= int64(col.DocMaxRoom) && docEnd > 0 && docEnd <= col.Used {
			if validity == 1 && !fun(id, col.Buf[id+DocHeader:docEnd]) {
				break
			}
			id = docEnd
		} else {
			// Corrupted document - move on
			id++
		}
	}
}
229540
func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery {
	q.cutoffFrequency = &cutoff
	return q
}
328512
func (v *view) max(filter *Row, bitDepth uint) (max, count uint64, err error) {
	for _, f := range v.allFragments() {
		fmax, fcount, err := f.max(filter, bitDepth)
		if err != nil {
			return max, count, err
		}
		if fcount > 0 && fmax > max {
			max = fmax
			count += fcount
		}
	}
	return max, count, nil
}