1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Make search re-indexing multi-tenant aware

Makes things easier when having to reindex in multi-tenant deployments.
This commit is contained in:
Harvey Kandola 2018-10-06 17:23:55 +01:00
parent 85b3f6e8ee
commit 8eb930d281
7 changed files with 731 additions and 684 deletions

View file

@ -28,7 +28,7 @@ type Store struct {
store.AttachmentStorer
}
// Add inserts the given record into the database attachement table.
// Add inserts the given record into the database attachment table.
func (s Store) Add(ctx domain.RequestContext, a attachment.Attachment) (err error) {
a.OrgID = ctx.OrgID
a.Created = time.Now().UTC()
@ -64,7 +64,7 @@ func (s Store) GetAttachment(ctx domain.RequestContext, orgID, attachmentID stri
return
}
// GetAttachments returns a slice containing the attachement records (excluding their data) for document docID, ordered by filename.
// GetAttachments returns a slice containing the attachment records (excluding their data) for document docID, ordered by filename.
func (s Store) GetAttachments(ctx domain.RequestContext, docID string) (a []attachment.Attachment, err error) {
err = s.Runtime.Db.Select(&a, s.Bind(`
SELECT id, c_refid AS refid,
@ -72,7 +72,7 @@ func (s Store) GetAttachments(ctx domain.RequestContext, docID string) (a []atta
c_filename AS filename, c_extension AS extension,
c_created AS created, c_revised AS revised
FROM dmz_doc_attachment
WHERE c_orgid=? and c_docid=?
WHERE c_orgid=? AND c_docid=?
ORDER BY c_filename`),
ctx.OrgID, docID)
@ -88,7 +88,7 @@ func (s Store) GetAttachments(ctx domain.RequestContext, docID string) (a []atta
return
}
// GetAttachmentsWithData returns a slice containing the attachement records (including their data) for document docID, ordered by filename.
// GetAttachmentsWithData returns a slice containing the attachment records (including their data) for document docID, ordered by filename.
func (s Store) GetAttachmentsWithData(ctx domain.RequestContext, docID string) (a []attachment.Attachment, err error) {
err = s.Runtime.Db.Select(&a, s.Bind(`
SELECT id, c_refid AS refid,