feat(search): index arbitrary metadata for full-text search#2987
Open
flash7777 wants to merge 2 commits into
Open
feat(search): index arbitrary metadata for full-text search#2987flash7777 wants to merge 2 commits into
flash7777 wants to merge 2 commits into
Conversation
added 2 commits
June 21, 2026 13:33
All ArbitraryMetadata fields (stored as user.oc.md.* xattrs) are now extracted during content indexing and stored in a searchable Metadata sub-document in the Bleve index. Previously only the "tags" field was extracted from ArbitraryMetadata. Now all fields are indexed, making custom metadata like oy.fileReference (Aktenzeichen), oy.status, oy.subject, and user-defined info.* fields discoverable through the standard OpenCloud search. Changes: - content.go: add Metadata map[string]string to Document - basic.go: extract all ArbitraryMetadata entries (not just tags) - bleve/index.go: add dynamic Metadata sub-document mapping - bleve/bleve.go: reconstruct Metadata map from search results
When a search matches on metadata fields (e.g. oy.fileReference, oy.subject), the highlight now includes the matched field name and value, separated by " · " from content highlights. Example highlight: "oy.fileReference: <mark>11.12.01</mark>" Applied to both Bleve and OpenSearch backends.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 14 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Index all
ArbitraryMetadatafields (stored asuser.oc.md.*xattrs) in the search index and include metadata matches in search highlights.Motivation
Applications that store domain-specific metadata via
SetArbitraryMetadata(e.g. file references, document status, custom fields) currently cannot leverage the built-in search. Users expect to find documents by their metadata values, not just by filename or content.Changes
content/content.goMetadata map[string]stringtoDocumentcontent/basic.goArbitraryMetadataentries (not justtags)bleve/index.goMetadatasub-document mappingbleve/bleve.goMetadatamap from search results + highlight metadata matchesbleve/backend.goMetadata.*fieldsopensearch/convertApology
Sorry about the previous PR #2977 — a tooling issue caused the entire build branch to be included instead of just the search changes. This is a clean replacement with only the relevant diff (6 files, 63 lines).
Test plan
SetArbitraryMetadataoy.fileReference: <mark>11.12.01</mark>)