1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-06 22:15:25 +02:00

Introduce transaction isolation customization

Search related indexing transactions requires better TX begin/commit.

New helpers provide TX isolation control.
This commit is contained in:
McMatts 2019-03-08 15:50:55 +00:00
parent 36d7136210
commit f062005946
5 changed files with 63 additions and 65 deletions

View file

@ -24,7 +24,6 @@ import (
"github.com/documize/community/model/doc"
"github.com/documize/community/model/page"
"github.com/documize/community/model/search"
"github.com/documize/community/model/workflow"
"github.com/pkg/errors"
)
@ -125,11 +124,6 @@ func (s Store) DeleteDocument(ctx domain.RequestContext, ID string) (err error)
func (s Store) IndexContent(ctx domain.RequestContext, p page.Page) (err error) {
method := "search.IndexContent"
// we do not index pending pages
if p.Status == workflow.ChangePending || p.Status == workflow.ChangePendingNew {
return
}
// remove previous search entries
_, err = ctx.Transaction.Exec(s.Bind("DELETE FROM dmz_search WHERE c_orgid=? AND c_docid=? AND c_itemid=? AND c_itemtype='page'"),
ctx.OrgID, p.DocumentID, p.RefID)