mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +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"
|
||||
var err error
|
||||
|
||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
||||
tx, err := m.runtime.Db.Beginx()
|
||||
if err != nil {
|
||||
m.runtime.Log.Error(method, err)
|
||||
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)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
tx.Rollback()
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
tx.Commit()
|
||||
}
|
||||
|
||||
// DeleteDocument removes all search entries for document.
|
||||
|
@ -45,7 +45,7 @@ func (m *Indexer) DeleteDocument(ctx domain.RequestContext, ID string) {
|
|||
method := "search.DeleteDocument"
|
||||
var err error
|
||||
|
||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
||||
tx, err := m.runtime.Db.Beginx()
|
||||
if err != nil {
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
|
@ -53,12 +53,12 @@ func (m *Indexer) DeleteDocument(ctx domain.RequestContext, ID string) {
|
|||
|
||||
err = m.store.Search.DeleteDocument(ctx, ID)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
tx.Rollback()
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
tx.Commit()
|
||||
}
|
||||
|
||||
// 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"
|
||||
var err error
|
||||
|
||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
||||
tx, err := m.runtime.Db.Beginx()
|
||||
if err != nil {
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
|
@ -75,12 +75,12 @@ func (m *Indexer) IndexContent(ctx domain.RequestContext, p page.Page) {
|
|||
|
||||
err = m.store.Search.IndexContent(ctx, p)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
tx.Rollback()
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
tx.Commit()
|
||||
}
|
||||
|
||||
// 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"
|
||||
var err error
|
||||
|
||||
ctx.Transaction, err = m.runtime.Db.Beginx()
|
||||
tx, err := m.runtime.Db.Beginx()
|
||||
if err != nil {
|
||||
m.runtime.Log.Error(method, err)
|
||||
return
|
||||
|
@ -96,10 +96,10 @@ func (m *Indexer) DeleteContent(ctx domain.RequestContext, pageID string) {
|
|||
|
||||
err = m.store.Search.DeleteContent(ctx, pageID)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
tx.Rollback()
|
||||
m.runtime.Log.Error(method, err)
|
||||
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-9 value">
|
||||
{{#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}}
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue