Search: index arbitrary metadata for full-text search#2977
Draft
flash7777 wants to merge 10 commits into
Draft
Conversation
Add four new LibreGraph driveItem actions for the container-specific and immutable permissions introduced in cs3org/cs3apis#272: - DriveItemContainerDelete → CS3 DeleteContainer (delete folders) - DriveItemContainerUpdate → CS3 MoveContainer (move/rename folders) - DriveItemImmutableFileSet → CS3 SetImmutableFile (freeze files) - DriveItemImmutableFolderSet → CS3 SetImmutableContainer (protect folders) Conversion functions updated in both directions (CS3 ↔ LibreGraph). Role definitions automatically pick up the new actions via CS3ResourcePermissionsToLibregraphActions(). Depends on: opencloud-eu/reva#676 (go-cs3apis bump with new fields)
…ources
Three new Graph API endpoints on drive items:
POST /drives/{driveID}/items/{itemID}/freeze - freeze a file (irreversible)
POST /drives/{driveID}/items/{itemID}/protect - protect a directory (reversible)
DELETE /drives/{driveID}/items/{itemID}/protect - unprotect a directory
Semantics:
- freeze: sets immutable on files, cannot be undone, client must confirm
- protect: sets immutable on directories, can be reversed by managers
- unprotect: removes immutable from directories
Each endpoint validates the resource type (file vs directory) and returns
appropriate errors for type mismatches, permission denied, and not found.
Depends on: opencloud-eu/reva#676 (SetImmutable/UnsetImmutable RPCs)
1. GET /drives/{driveID}/items/{itemID}/metadata
Returns all custom metadata (user.oc.md.*) as JSON.
Tested: oy.* Aktenplan metadata successfully returned.
2. Container/immutable permission actions (conversion.go, roles.go)
DriveItemContainerDelete, DriveItemContainerUpdate,
DriveItemImmutableFileSet, DriveItemImmutableFolderSet
3. Labels API fix (follow.go)
provider.AddLabelRequest → labels.AddLabelRequest
- freeze/protect/unprotect Graph API endpoints - go-cs3apis replace in Dockerfile for gateway SetImmutable - .dockerignore for clean builds
Register "kosmos" as a valid edition so the version output shows "Edition: kosmos" instead of falling back to "dev" with an error log. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New global role "Manager" (User + Drives.ManageImmutable) allows protect/unprotect/freeze on any space without needing the space-level Manager role. Also adds ManageImmutable to Admin and SpaceAdmin roles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allows setting arbitrary metadata (user.oc.md.*) on drive items via
PUT /graph/v1beta1/drives/{driveID}/items/{itemID}/metadata with a
JSON body of key-value pairs. Complements the existing GET endpoint.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 3 medium |
| CodeStyle | 97 minor |
🟢 Metrics 50 complexity · -118 duplication
Metric Results Complexity 50 Duplication -118
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.
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.
Member
|
This PR is in no reviewable condition, please clean it up first. Converting it to draft (for now). |
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
ArbitraryMetadatafields (stored asuser.oc.md.*xattrs) in the search index, not justtagsoy.fileReference,oy.status,oy.subject, and user-defined fields become discoverable through the standard OpenCloud searchMotivation
Applications that store domain-specific metadata via
SetArbitraryMetadata(e.g. DMS file references, document status, custom index 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 resultsTest plan
SetArbitraryMetadata