[full-ci] experimental search backport (#5221)

* experimental search backport
fix basic extractor resource name
move escapeQuery regex into global variable
minor pr review changes
rename DebounceDuration env variable
add document title and content when rebuilding bleve resource

Co-authored-by: David Christofas <dchristofas@owncloud.com>
This commit is contained in:
Florian Schade
2022-12-13 14:22:41 +01:00
committed by GitHub
co-authored by David Christofas
parent 2fa1a3afbe
commit 2404eff48e
48 changed files with 2777 additions and 2245 deletions
+33
View File
@@ -0,0 +1,33 @@
package content
import (
"context"
"errors"
"fmt"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
)
// Extractor is responsible to extract content and meta information from documents.
//
//go:generate mockery --name=Extractor
type Extractor interface {
Extract(ctx context.Context, ri *provider.ResourceInfo) (Document, error)
}
func getFirstValue(m map[string][]string, key string) (string, error) {
if m == nil {
return "", errors.New("undefined map")
}
v, ok := m[key]
if !ok {
return "", fmt.Errorf("unknown key: %v", key)
}
if len(m) == 0 {
return "", fmt.Errorf("no values for: %v", key)
}
return v[0], nil
}