mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 10:34:42 -05:00
* chore: bump reva to 2.52.2 * Merge pull request #42 from opencloud-eu/fix-web-theme-merge fix(web): merge copies of the theme sources so themeDefaults is never mutated * Merge pull request #43 from opencloud-eu/fix-search-trailing-not fix(search): handle missing operands in the bleve compiler * Merge pull request #44 from opencloud-eu/fix-search-highlight-escaping fix(search): escape file content in OpenSearch highlights --------- Co-authored-by: Ralf Haferkamp <r.haferkamp@opencloud.eu> Co-authored-by: Florian Schade <f.schade@icloud.com>
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package content
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/bbalet/stopwords"
|
|
libregraph "github.com/opencloud-eu/libre-graph-api-go"
|
|
)
|
|
|
|
func init() {
|
|
stopwords.OverwriteWordSegmenter(`[^ ]+`)
|
|
}
|
|
|
|
// Document wraps all resource meta fields,
|
|
// it is used as a content extraction result.
|
|
type Document struct {
|
|
Title string `json:"Title"`
|
|
Name string `json:"Name"`
|
|
Content string `json:"Content"`
|
|
Size uint64 `json:"Size"`
|
|
Mtime *time.Time `json:"Mtime,omitempty"`
|
|
MimeType string `json:"MimeType"`
|
|
Tags []string `json:"Tags"`
|
|
Favorites []string `json:"Favorites"`
|
|
Audio *libregraph.Audio `json:"audio,omitempty"`
|
|
Image *libregraph.Image `json:"image,omitempty"`
|
|
Location *libregraph.GeoCoordinates `json:"location,omitempty"`
|
|
Photo *libregraph.Photo `json:"photo,omitempty"`
|
|
Video *libregraph.Video `json:"video,omitempty"`
|
|
MotionPhoto *libregraph.MotionPhoto `json:"motionPhoto,omitempty"`
|
|
LivePhoto *libregraph.LivePhoto `json:"livePhoto,omitempty"`
|
|
}
|
|
|
|
func CleanString(content, langCode string) string {
|
|
return strings.TrimSpace(stopwords.CleanString(content, langCode, false))
|
|
}
|