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

@ -204,7 +204,7 @@ func (h *Handler) Reindex(w http.ResponseWriter, r *http.Request) {
func (h *Handler) rebuildSearchIndex(ctx domain.RequestContext) {
method := "meta.rebuildSearchIndex"
docs, err := h.Store.Meta.GetDocumentsID(ctx)
docs, err := h.Store.Meta.Documents(ctx)
if err != nil {
h.Runtime.Log.Error(method, err)
return
@ -215,23 +215,23 @@ func (h *Handler) rebuildSearchIndex(ctx domain.RequestContext) {
for i := range docs {
d := docs[i]
doc, err := h.Store.Document.Get(ctx, d)
dc, err := h.Store.Meta.Document(ctx, d)
if err != nil {
h.Runtime.Log.Error(method, err)
return
// continue
}
at, err := h.Store.Attachment.GetAttachments(ctx, d)
at, err := h.Store.Meta.Attachments(ctx, d)
if err != nil {
h.Runtime.Log.Error(method, err)
return
// continue
}
h.Indexer.IndexDocument(ctx, doc, at)
h.Indexer.IndexDocument(ctx, dc, at)
pages, err := h.Store.Meta.GetDocumentPages(ctx, d)
pages, err := h.Store.Meta.Pages(ctx, d)
if err != nil {
h.Runtime.Log.Error(method, err)
return
// continue
}
for j := range pages {