-
Notifications
You must be signed in to change notification settings - Fork 231
feat(search): Add photo EXIF metadata to search index and WebDAV resultsFeature/photo metadata search #11912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(search): Add photo EXIF metadata to search index and WebDAV resultsFeature/photo metadata search #11912
Conversation
This change enables photo gallery applications to access EXIF metadata through the search API. Changes: - Add KQL query support for photo fields: - photo.takenDateTime (datetime range queries) - photo.cameraMake, photo.cameraModel (keyword queries) - photo.fNumber, photo.focalLength, photo.iso (numeric queries) - Configure Bleve index to store photo fields (Store=true) - Map photo metadata from Bleve hits to Entity.Photo protobuf - Add oc:photo-* properties to WebDAV search responses - Add unit tests for photo field queries The photo metadata is extracted by Tika during indexing and stored in the Bleve search index. This enables queries like: photo.takenDateTime:[2023-01-01 TO 2023-12-31] photo.cameraMake:Canon Signed-off-by: Paul Faure <[email protected]> Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add location field mappings with Store=true in Bleve index - Rename properties to oc:photo-location-* for consistency - Add altitude support alongside latitude/longitude - Requires index rebuild to take effect
- Add exposure numerator/denominator to search results - Add altitude extraction from Tika GPS metadata - All photo EXIF fields now fully exposed via WebDAV search
kobergj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 I love it. Just some question (probably just stupid me) and a super small fix to make the linter happy.
| if field, ok := _photoFields[parts[1]]; ok { | ||
| return field | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand why we need this check. Can't we just return name in this case?
| if field, ok := _photoFields[parts[1]]; ok { | ||
| return field | ||
| } | ||
| // Future: case "audio", "image", "location" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter complains about file not being properly formatted. I think you need to move this comment above the case statement.
|
Thanks for the review @kobergj!
*Re: the map lookup check*
Good question! The _photoFields map serves two purposes:
1. *Case normalization* - Converts user input like photo.cameramake to
the indexed field name photo.cameraMake (camelCase as stored in Bleve)
2. *Field validation* - Only allows known photo fields to be queried
You're right that we could simplify by just returning name for unknown
fields (which happens anyway via the fallback at the end). The current
check is perhaps overly defensive - if someone queries photo.unknownField,
they'd just get zero results rather than an error, which is fine.
If you'd prefer, I can simplify it to:
case "photo":
if field, ok := _photoFields[parts[1]]; ok {
return field
}
return name // Let unknown photo.* fields pass through
Or even simpler, remove the if check entirely and just do the map lookup
with a fallback. Let me know your preference!
*Re: linter*
Fixed! Moved the comment above the switch block. See commit 7500db7.
…On Fri, Jan 16, 2026 at 5:47 AM kobergj ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Nice 👍 I love it. Just some question (probably just stupid me) and a
super small fix to make the linter happy.
------------------------------
In services/search/pkg/query/bleve/compiler.go
<#11912 (comment)>:
> + if field, ok := _photoFields[parts[1]]; ok {
+ return field
+ }
I don't quite understand why we need this check. Can't we just return name
in this case?
------------------------------
In services/search/pkg/query/bleve/compiler.go
<#11912 (comment)>:
> @@ -269,8 +281,22 @@ func getField(name string) string {
if name == "" {
return "Name"
}
- if _, ok := _fields[strings.ToLower(name)]; ok {
- return _fields[strings.ToLower(name)]
+ lower := strings.ToLower(name)
+
+ // Handle nested field prefixes (e.g., "photo.takenDateTime")
+ if parts := strings.SplitN(lower, ".", 2); len(parts) == 2 {
+ switch parts[0] {
+ case "photo":
+ if field, ok := _photoFields[parts[1]]; ok {
+ return field
+ }
+ // Future: case "audio", "image", "location"
Linter complains about file not being properly formatted. I think you need
to move this comment above the case statement.
—
Reply to this email directly, view it on GitHub
<#11912 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHPUZWPO3AXLYQTMNWWOUTT4HC6SNAVCNFSM6AAAAACR3ZYU52VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNZQGEZDKNZRGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Paul N. Faure, B.Eng 613.262.2354
Computer Systems Engineer paul-at-faure-dot-ca
|
|



Pull Request: Photo EXIF Metadata Search Support
Title:
feat(search): Add photo EXIF metadata to search index and WebDAV resultsDescription
This PR adds support for photo EXIF metadata in the Bleve search index and WebDAV REPORT responses. Photo metadata fields are now indexed, searchable via KQL queries, and returned in WebDAV search results.
This enables web extensions and applications to:
Changes Summary
Related Issue
Motivation and Context
oCIS already extracts and stores photo EXIF metadata via Tika during indexing, but this data was not:
Store=true)This PR addresses all three gaps, enabling photo-centric applications to be built on oCIS.
Use Case Example
I've built a photo gallery web extension (ocis-photo-addon) that uses these APIs to:
How Has This Been Tested?
Test Environment
Test Cases
1. KQL Date Range Query
2. KQL Camera Filter Query
3. WebDAV Response Verification Response includes photo properties:
4. Unit Tests
All new tests pass for photo field queries.
Screenshots
N/A - Backend/API changes only. However, the photo-addon extension demonstrates the UI possibilities this enables.
Types of changes
Checklist
Additional Notes
Key Implementation Detail
The critical fix was adding explicit field mappings with
Store=trueinbleve.go. Without this, Bleve indexes the fields for searching but doesn't store the values for retrieval:Backward Compatibility
Future Considerations
- This could be extended to support video metadata
- Face detection/recognition could use similar patterns
- Album/collection grouping could build on this foundation
# Pull Request: Photo EXIF Metadata Search SupportTitle:
feat(search): Add photo EXIF metadata to search index and WebDAV resultsDescription
This PR adds support for photo EXIF metadata in the Bleve search index and WebDAV REPORT responses. Photo metadata fields are now indexed, searchable via KQL queries, and returned in WebDAV search results.
This enables web extensions and applications to:
Changes Summary
ocis-pkg/kql/dictionary.pegphotokeyword to KQL grammarocis-pkg/kql/dictionary_gen.goservices/search/pkg/engine/bleve.goStore=truefor photo fieldsservices/search/pkg/query/bleve/compiler.goservices/search/pkg/query/bleve/compiler_test.goservices/search/pkg/search/service.goservices/webdav/pkg/service/v0/search.gooc:photo-*WebDAV propertiesRelated Issue
Motivation and Context
oCIS already extracts and stores photo EXIF metadata via Tika during indexing, but this data was not:
Store=true)This PR addresses all three gaps, enabling photo-centric applications to be built on oCIS.
Use Case Example
I've built a photo gallery web extension ([ocis-photo-addon](https://github.com/paul43210/ocis-photo-addon)) that uses these APIs to:
How Has This Been Tested?
Test Environment
Test Cases
1. KQL Date Range Query
2. KQL Camera Filter Query
3. WebDAV Response Verification
Response includes photo properties:
4. Unit Tests
go test ./services/search/pkg/query/bleve/... -vAll new tests pass for photo field queries.
Screenshots
N/A - Backend/API changes only. However, the [photo-addon extension](https://github.com/paul43210/ocis-photo-addon) demonstrates the UI possibilities this enables.
Types of changes
Checklist
Additional Notes
Key Implementation Detail
The critical fix was adding explicit field mappings with
Store=trueinbleve.go. Without this, Bleve indexes the fields for searching but doesn't store the values for retrieval:Backward Compatibility
Future Considerations