mirror of
https://github.com/documize/community.git
synced 2025-07-26 00:29:47 +02:00
Implement new search page query filters
This commit is contained in:
parent
18930fb610
commit
0d78cf3dda
2 changed files with 14 additions and 14 deletions
|
@ -24,7 +24,7 @@ func (m *Indexer) IndexDocument(ctx domain.RequestContext, d doc.Document, a []a
|
||||||
method := "search.IndexDocument"
|
method := "search.IndexDocument"
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
tx, err := m.runtime.Db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
|
@ -32,12 +32,12 @@ func (m *Indexer) IndexDocument(ctx domain.RequestContext, d doc.Document, a []a
|
||||||
|
|
||||||
err = m.store.Search.IndexDocument(ctx, d, a)
|
err = m.store.Search.IndexDocument(ctx, d, a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
tx.Rollback()
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteDocument removes all search entries for document.
|
// DeleteDocument removes all search entries for document.
|
||||||
|
@ -45,7 +45,7 @@ func (m *Indexer) DeleteDocument(ctx domain.RequestContext, ID string) {
|
||||||
method := "search.DeleteDocument"
|
method := "search.DeleteDocument"
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
tx, err := m.runtime.Db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
|
@ -53,12 +53,12 @@ func (m *Indexer) DeleteDocument(ctx domain.RequestContext, ID string) {
|
||||||
|
|
||||||
err = m.store.Search.DeleteDocument(ctx, ID)
|
err = m.store.Search.DeleteDocument(ctx, ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
tx.Rollback()
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexContent adds search index entry for document context.
|
// IndexContent adds search index entry for document context.
|
||||||
|
@ -67,7 +67,7 @@ func (m *Indexer) IndexContent(ctx domain.RequestContext, p page.Page) {
|
||||||
method := "search.IndexContent"
|
method := "search.IndexContent"
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
tx, err := m.runtime.Db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
|
@ -75,12 +75,12 @@ func (m *Indexer) IndexContent(ctx domain.RequestContext, p page.Page) {
|
||||||
|
|
||||||
err = m.store.Search.IndexContent(ctx, p)
|
err = m.store.Search.IndexContent(ctx, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
tx.Rollback()
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteContent removes all search entries for specific document content.
|
// DeleteContent removes all search entries for specific document content.
|
||||||
|
@ -88,7 +88,7 @@ func (m *Indexer) DeleteContent(ctx domain.RequestContext, pageID string) {
|
||||||
method := "search.DeleteContent"
|
method := "search.DeleteContent"
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
tx, err := m.runtime.Db.Beginx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
|
@ -96,10 +96,10 @@ func (m *Indexer) DeleteContent(ctx domain.RequestContext, pageID string) {
|
||||||
|
|
||||||
err = m.store.Search.DeleteContent(ctx, pageID)
|
err = m.store.Search.DeleteContent(ctx, pageID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
tx.Rollback()
|
||||||
m.runtime.Log.Error(method, err)
|
m.runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<div class="col-12 col-sm-3 heading">Tags</div>
|
<div class="col-12 col-sm-3 heading">Tags</div>
|
||||||
<div class="col-12 col-sm-9 value">
|
<div class="col-12 col-sm-9 value">
|
||||||
{{#each tagz as |t index|}}
|
{{#each tagz as |t index|}}
|
||||||
{{#link-to 'search' (query-params filter=t matchTag=true)}}
|
{{#link-to 'search' (query-params filter=t matchTag=true matchDoc=false matchContent=false matchAttachment=false)}}
|
||||||
{{concat '#' t}}
|
{{concat '#' t}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue