feat(search): gator fields in oo_docs_text + field filters (#86)
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Test (Go stable) (pull_request) Failing after 3s
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 1m30s

- TextDoc carries gator keyword fields (doc_sha, number, seller, total, typ,
  issued_at, created_at, status, url); content is now omitempty so a partial
  doc can be written.
- oo_docs_text mapping extended with the keyword fields.
- ESTextIndex.UpsertFields: bulk update + doc_as_upsert, merging gator fields
  into an existing text doc without clobbering title/content.
- SearchQuery gains Seller/Number/Status term filters; SearchHit.Fields exposes
  the gator values. Pure builders unit-tested.
This commit is contained in:
2026-10-07 08:20:29 +00:00
parent a14466ce7a
commit 3f7505892f
3 changed files with 179 additions and 14 deletions
+9 -2
View File
@@ -82,7 +82,8 @@ type FileStore interface {
// SearchQuery narrows a Searcher request. InContent asks the backend to match
// document bodies, not just titles. Substring switches title matching from the
// analyzer's whole-token match to a case-insensitive "*term*" wildcard and ANDs
// every whitespace-separated term (e.g. "rechnung 2025").
// every whitespace-separated term (e.g. "rechnung 2025"). Seller/Number/Status
// are exact filters over gator fields indexed into oo_docs_text (Option D).
type SearchQuery struct {
Text string
InContent bool
@@ -90,15 +91,21 @@ type SearchQuery struct {
Extensions []string
Limit int
Substring bool
Seller string
Number string
Status string
}
// SearchHit is one Searcher result: the matching entry plus backend-specific
// ranking metadata.
// ranking metadata. Fields carries backend-specific extra key/values (for
// oo_docs_text: gator document fields such as rechnungsnummer, lieferant,
// betrag, status).
type SearchHit struct {
Entry
Score float64
Highlight string
Path []string
Fields map[string]string
}
// Searcher is the optional content/name search surface. Only some backends