// NewDocIdQuery creates a new DocIdQuery.
544052
func NewDocIdQuery(ids ...string) *DocIdQuery {
	q := &DocIdQuery{newFtsQueryBase()}
	q.options["ids"] = []string{}
	return q.AddDocIds(ids...)
}
800331
func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {
	return InlineQueryResultDocument{
		Type:     "document",
		ID:       id,
		URL:      url,
		Title:    title,
		MimeType: mimeType,
	}
}
1060930
func NewPaperDocEditDetails(EventUuid string) *PaperDocEditDetails {
	s := new(PaperDocEditDetails)
	s.EventUuid = EventUuid
	return s
}
844306
func (_m *QueryCreator) NewQuery() (cc.Query, error) {
	ret := _m.Called()

	var r0 cc.Query
	if rf, ok := ret.Get(0).(func() cc.Query); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(cc.Query)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
792595
func newQuery(t Term, qopts map[string]interface{}, copts *ConnectOpts) (q Query, err error) {
	queryOpts := map[string]interface{}{}
	for k, v := range qopts {
		queryOpts[k], err = Expr(v).Build()
		if err != nil {
			return
		}
	}
	if copts.Database != "" {
		queryOpts["db"], err = DB(copts.Database).Build()
		if err != nil {
			return
		}
	}

	builtTerm, err := t.Build()
	if err != nil {
		return q, err
	}

	// Construct query
	return Query{
		Type:      p.Query_START,
		Term:      &t,
		Opts:      queryOpts,
		builtTerm: builtTerm,
	}, nil
}
1229638
func NewPaperDocMentionType(Description string) *PaperDocMentionType {
	s := new(PaperDocMentionType)
	s.Description = Description
	return s
}
966158
func NewCommonQuery(name string, query string) CommonQuery {
	q := CommonQuery{name: name, query: query}
	return q
}
1131636
func (q *Query) ToDatastoreQuery() *datastore.Query {
	dq := datastore.NewQuery(q.Kind)
	if q.Ancestor != nil {
		dq = dq.Ancestor(q.Ancestor)
	}
	return dq
}
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
}
58634
func (col *Col) indexDoc(id int, doc map[string]interface{}) {
	for idxName, idxPath := range col.indexPaths {
		for _, idxVal := range GetIn(doc, idxPath) {
			if idxVal != nil {
				hashKey := StrHash(fmt.Sprint(idxVal))
				partNum := hashKey % col.db.numParts
				ht := col.hts[partNum][idxName]
				ht.Lock.Lock()
				ht.Put(hashKey, id)
				ht.Lock.Unlock()
			}
		}
	}
}
338290
func NewWildcardQuery(wildcard string) *WildcardQuery {
	q := &WildcardQuery{newFtsQueryBase()}
	q.options["wildcard"] = wildcard
	return q
}
1003310
func NewLDAPQuery(config config.LDAPQuery) (LDAPQuery, error) {
	scope, err := DetermineLDAPScope(config.Scope)
	if err != nil {
		return LDAPQuery{}, err
	}

	derefAliases, err := DetermineDerefAliasesBehavior(config.DerefAliases)
	if err != nil {
		return LDAPQuery{}, err
	}

	return LDAPQuery{
		BaseDN:       config.BaseDN,
		Scope:        scope,
		DerefAliases: derefAliases,
		TimeLimit:    config.TimeLimit,
		Filter:       config.Filter,
		PageSize:     config.PageSize,
	}, nil
}
804739
func NewPaperDocCreateUpdateResult(DocId string, Revision int64, Title string) *PaperDocCreateUpdateResult {
	s := new(PaperDocCreateUpdateResult)
	s.DocId = DocId
	s.Revision = Revision
	s.Title = Title
	return s
}
961295
func NewListPaperDocsResponse(DocIds []string, Cursor *Cursor, HasMore bool) *ListPaperDocsResponse {
	s := new(ListPaperDocsResponse)
	s.DocIds = DocIds
	s.Cursor = Cursor
	s.HasMore = HasMore
	return s
}
153759
func NewPrefixQuery(name string, prefix string) *PrefixQuery {
	return &PrefixQuery{name: name, prefix: prefix}
}
808189
func NewDocument(p unsafe.Pointer, contentLen int, inEncoding, outEncoding []byte) (doc *XmlDocument) {
	inEncoding = AppendCStringTerminator(inEncoding)
	outEncoding = AppendCStringTerminator(outEncoding)

	xmlNode := &XmlNode{Ptr: (*C.xmlNode)(p)}
	docPtr := (*C.xmlDoc)(p)
	doc = &XmlDocument{Ptr: docPtr, Node: xmlNode, InEncoding: inEncoding, OutEncoding: outEncoding, InputLen: contentLen}
	doc.UnlinkedNodes = make(map[*C.xmlNode]bool)
	doc.XPathCtx = xpath.NewXPath(p)
	doc.Type = xmlNode.NodeType()
	doc.fragments = make([]*DocumentFragment, 0, initialFragments)
	doc.Me = doc
	xmlNode.Document = doc
	//runtime.SetFinalizer(doc, (*XmlDocument).Free)
	return
}
144710
func NewPaperDocumentLogInfo(DocId string, DocTitle string) *PaperDocumentLogInfo {
	s := new(PaperDocumentLogInfo)
	s.DocId = DocId
	s.DocTitle = DocTitle
	return s
}