func (b *BytesRefBuilder) Grow(capacity int) {
	b.ref.Bytes = GrowByteSlice(b.ref.Bytes, capacity)
}
/* Ensure that this builder can hold at least capacity bytes without resizing.
package util
var EMPTY_BYTES = []byte{}
type BytesRef struct {
	Bytes  []byte
	Offset int
	Length int
}
func NewEmptyBytesRef() *BytesRef {
	return NewBytesRefFrom(EMPTY_BYTES)
}
func NewBytesRef(bytes []byte, offset, length int) *BytesRef {
	return &BytesRef{
		Bytes:  bytes,
		Offset: offset,
		Length: length,
	}
}
func NewBytesRefFrom(bytes []byte) *BytesRef {
	return NewBytesRef(bytes, 0, len(bytes))
}
func DeepCopyOf(other *BytesRef) *BytesRef {
	copy := NewEmptyBytesRef()
	copy.copyBytes(other)
	return copy
}
func (br *BytesRef) bytesEquals(other []byte) bool {
	if br.Length != len(other) {
		return false
	}
	for i, v := range br.ToBytes() {
		if v != other[i] {
			return false
		}
	}
	return true
}
func (br *BytesRef) String() string {
	panic("not implemented yet")
}
func (br *BytesRef) ToBytes() []byte {
	return br.Bytes[br.Offset : br.Offset+br.Length]
}
func (a *BytesRef) copyBytes(other *BytesRef) {
	if len(a.Bytes)-a.Offset < other.Length {
		a.Bytes = make([]byte, other.Length)
		a.Offset = 0
	}
	copy(a.Bytes, other.Bytes[other.Offset:other.Offset+other.Length])
	a.Length = other.Length
}
func UTF8SortedAsUnicodeLess(aBytes, bBytes []byte) bool {
	aLen, bLen := len(aBytes), len(bBytes)
	for i, v := range aBytes {
		if i >= bLen {
			break
		}
		if v < bBytes[i] {
			return true
		} else if v > bBytes[i] {
			return false
		}
	}
	return aLen < bLen
}
type BytesRefs [][]byte
func (br BytesRefs) Len() int {
	return len(br)
}
func (br BytesRefs) Less(i, j int) bool {
	aBytes, bBytes := br[i], br[j]
	return UTF8SortedAsUnicodeLess(aBytes, bBytes)
}
func (br BytesRefs) Swap(i, j int) {
	br[i], br[j] = br[j], br[i]
}
type BytesRefBuilder struct {
	ref *BytesRef
}
func NewBytesRefBuilder() *BytesRefBuilder {
	return &BytesRefBuilder{
		ref: NewEmptyBytesRef(),
	}
}
func (b *BytesRefBuilder) Bytes() []byte {
	return b.ref.Bytes
}
func (b *BytesRefBuilder) Length() int {
	return b.ref.Length
}
func (b *BytesRefBuilder) SetLength(length int) {
	b.ref.Length = length
}
func (b *BytesRefBuilder) At(offset int) byte {
	return b.ref.Bytes[offset]
}
func (b *BytesRefBuilder) Set(offset int, v byte) {
	b.ref.Bytes[offset] = v
}