Address reviewer feedback: - Remove checksum field from index (bloats index, not searched) - Remove skipUnchangedContent guard (not needed with UpdateTags path) - Replace engine.Retrieve() with engine.Update(id, mutateFn) that does get+mutate+set internally, avoiding public exposure of raw retrieval - Simplify UpdateTags to use engine.Update() with mutation function Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
801 B
Go
33 lines
801 B
Go
package content
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/bbalet/stopwords"
|
|
libregraph "github.com/owncloud/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
|
|
Name string
|
|
Content string
|
|
Size uint64
|
|
Mtime string
|
|
MimeType string
|
|
Tags []string
|
|
Audio *libregraph.Audio `json:"audio,omitempty"`
|
|
Image *libregraph.Image `json:"image,omitempty"`
|
|
Location *libregraph.GeoCoordinates `json:"location,omitempty"`
|
|
Photo *libregraph.Photo `json:"photo,omitempty"`
|
|
}
|
|
|
|
func CleanString(content, langCode string) string {
|
|
return strings.TrimSpace(stopwords.CleanString(content, langCode, true))
|
|
}
|