some bug fixes
This commit is contained in:
parent
5649acf6a8
commit
577cf4d482
10 changed files with 83 additions and 17 deletions
|
|
@ -125,6 +125,30 @@ func loadConfig() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if config.RunDir == "" {
|
||||
config.RunDir = defRunDir
|
||||
}
|
||||
if config.User == "" {
|
||||
config.User = defRunUser
|
||||
}
|
||||
if config.Group == "" {
|
||||
config.Group = defRunGroup
|
||||
}
|
||||
if config.ListenAddr == "" {
|
||||
config.ListenAddr = defListen
|
||||
}
|
||||
if config.LogFile == "" {
|
||||
config.LogFile = defLogFile
|
||||
}
|
||||
if config.CMDTimeout == 0 {
|
||||
config.CMDTimeout = defTimeout
|
||||
}
|
||||
if config.TesseractThreads == 0 {
|
||||
config.TesseractThreads = tesseractThreads
|
||||
}
|
||||
if config.TesseractOEM == 0 {
|
||||
config.TesseractOEM = tesseractOEM
|
||||
}
|
||||
return file.Close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type User struct {
|
|||
type Result struct {
|
||||
ID string
|
||||
Path string
|
||||
Tags string
|
||||
Tags []string
|
||||
HTML template.HTML
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package index
|
|||
import (
|
||||
"errors"
|
||||
"git.giftfish.de/ston1th/docstore/pkg/core"
|
||||
"github.com/bcampbell/qs"
|
||||
"github.com/blevesearch/bleve"
|
||||
"github.com/blevesearch/bleve/document"
|
||||
"github.com/blevesearch/bleve/mapping"
|
||||
|
|
@ -107,7 +108,11 @@ func (i *Index) Delete(id string) error {
|
|||
}
|
||||
|
||||
func (i *Index) Search(search string) (results core.Results, err error) {
|
||||
req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(search))
|
||||
q, err := qs.Parse(search)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
req := bleve.NewSearchRequest(q)
|
||||
req.Highlight = bleve.NewHighlightWithStyle("html")
|
||||
req.Size = maxSearchResult
|
||||
res, err := i.i.Search(req)
|
||||
|
|
@ -129,7 +134,7 @@ func (i *Index) Search(search string) (results core.Results, err error) {
|
|||
for _, f := range frags {
|
||||
t += f
|
||||
}
|
||||
r.Tags = strings.ReplaceAll(strings.ReplaceAll(t, "<mark>", ""), "</mark>", "")
|
||||
r.Tags = append(r.Tags, strings.ReplaceAll(strings.ReplaceAll(t, "<mark>", ""), "</mark>", ""))
|
||||
}
|
||||
if fragField == textField || fragField == createdField {
|
||||
for _, f := range frags {
|
||||
|
|
|
|||
|
|
@ -297,6 +297,13 @@ const (
|
|||
<h2>{{.BodyTitle}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col col-nopad">
|
||||
<div class="alert alert-primary">
|
||||
<p>This log will display error information about batch operations such as <code>Retag All</code> or <code>Index All</code>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<textarea class="form-control input-sm md-text mono" rows="30" spellcheck="false" autofocus>{{.Data}}</textarea>
|
||||
</div>
|
||||
|
|
@ -451,20 +458,22 @@ const (
|
|||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Tag</th>
|
||||
<th>Tags</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $item := .Data}}
|
||||
<tr>
|
||||
<td>
|
||||
<a class="mono" href="{{$item.Path}}"><b>{{$item.Path}}</b></a>
|
||||
{{if $item.HTML}}
|
||||
<br><pre class="wrap">{{$item.HTML}}</pre>
|
||||
{{end}}
|
||||
<a class="mono" href="{{$item.Path}}"><b>{{$item.Path}}</b></a>
|
||||
{{if $item.HTML}}
|
||||
<br><pre class="wrap">{{$item.HTML}}</pre>
|
||||
{{end}}
|
||||
</td>
|
||||
<td>
|
||||
{{if $item.Tags}}<a href="/search?query=tags:{{$item.Tags}}" class="btn badge btn-primary">{{$item.Tags}}</a>{{end}}
|
||||
{{range $t := $item.Tags}}
|
||||
<a href="/search?query=tags:{{$t}}" class="btn badge btn-primary">{{$t}}</a>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
|
@ -477,9 +486,14 @@ const (
|
|||
<div class="col col-nopad">
|
||||
<div class="alert alert-primary">
|
||||
<h4>Query Syntax</h4>
|
||||
<p>Documentation: <a target="_blank" rel="noopener noreferrer" href="https://github.com/bcampbell/qs/blob/master/syntax.md">https://github.com/bcampbell/qs/blob/master/syntax.md</a></p>
|
||||
<p>Fields</p>
|
||||
<pre><code>tags:insurance
|
||||
tags:insurance or tags:invoice
|
||||
tags:insurance OR tags:invoice
|
||||
# combine tags
|
||||
tags:insurance AND tags:invoice
|
||||
# exclude tags
|
||||
tags:insurance -tags:invoice
|
||||
created:<="2016-09-21"</code></pre>
|
||||
<p>Fulltext</p>
|
||||
<pre><code>some text here</code></pre>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue