func NewMatchQueryOperator(match string, operator MatchQueryOperator) *matchQuery {
	return &matchQuery{
		Match:       match,
		BoostVal:    1.0,
		OperatorVal: operator,
	}
}
NewMatchQuery creates a Query for matching text.
An Analyzer is chosen based on the field.
Input text is analyzed using this analyzer.
Token terms resulting from this analysis are
used to perform term searches.  Result documents
must satisfy term searches according to given operator.
package bleve
import (
	"encoding/json"
	"fmt"
	"github.com/blevesearch/bleve/index"
	"github.com/blevesearch/bleve/search"
)
type matchQuery struct {
	Match        string             `json:"match"`
	FieldVal     string             `json:"field,omitempty"`
	Analyzer     string             `json:"analyzer,omitempty"`
	BoostVal     float64            `json:"boost,omitempty"`
	PrefixVal    int                `json:"prefix_length"`
	FuzzinessVal int                `json:"fuzziness"`
	OperatorVal  MatchQueryOperator `json:"operator,omitempty"`
}
type MatchQueryOperator int
const (
	MatchQueryOperatorOr = 0
	MatchQueryOperatorAnd = 1
)
func (o MatchQueryOperator) MarshalJSON() ([]byte, error) {
	switch o {
	case MatchQueryOperatorOr:
		return json.Marshal("or")
	case MatchQueryOperatorAnd:
		return json.Marshal("and")
	default:
		return nil, fmt.Errorf("cannot marshal match operator %d to JSON", o)
	}
}
func (o *MatchQueryOperator) UnmarshalJSON(data []byte) error {
	var operatorString string
	err := json.Unmarshal(data, &operatorString)
	if err != nil {
		return err
	}
	switch operatorString {
	case "or":
		*o = MatchQueryOperatorOr
		return nil
	case "and":
		*o = MatchQueryOperatorAnd
		return nil
	default:
		return matchQueryOperatorUnmarshalError(operatorString)
	}
}
type matchQueryOperatorUnmarshalError string
func (e matchQueryOperatorUnmarshalError) Error() string {
	return fmt.Sprintf("cannot unmarshal match operator '%s' from JSON", e)
}
func NewMatchQuery(match string) *matchQuery {
	return &matchQuery{
		Match:       match,
		BoostVal:    1.0,
		OperatorVal: MatchQueryOperatorOr,
	}
}