示例#1
0
func (pages *Pages) QueryDatetimeRangeInclusive(field, start, end string, startInc bool, endInc bool) *Pages {
	q := bleve.NewDateRangeInclusiveQuery(&start, &end, &startInc, &endInc)
	q.SetField(field)
	pages.queries = append(pages.queries, q)
	pages.clear()
	return pages
}
示例#2
0
文件: range.go 项目: bcampbell/qs
// try and build a query from the given params
func (rp *rangeParams) generate() (query.Query, error) {
	if rp.min == nil && rp.max == nil {
		return nil, fmt.Errorf("empty range")
	}
	isNumeric, f1, f2 := rp.numericArgs()
	if isNumeric {
		return bleve.NewNumericRangeInclusiveQuery(f1, f2, rp.minInclusive, rp.maxInclusive), nil
	}

	isDate, t1, t2 := rp.dateArgs()
	if isDate {
		return bleve.NewDateRangeInclusiveQuery(t1, t2, rp.minInclusive, rp.maxInclusive), nil
	}
	return nil, fmt.Errorf("not numeric")

}