@@ -110,6 +110,9 @@ pub const FIELDS: &[(&str, &str, Kind)] = &[
110110 ( "aperture" , "Aperture" , Kind :: Number ) ,
111111 ( "shutterSpeed" , "Shutter Speed" , Kind :: Number ) ,
112112 ( "iso" , "ISO Speed" , Kind :: Number ) ,
113+ ( "flash" , "Flash" , Kind :: Bool ) ,
114+ ( "exposureBias" , "Exposure Bias" , Kind :: Number ) ,
115+ ( "cameraSerial" , "Camera Serial Number" , Kind :: Text ) ,
113116 // Location
114117 ( "location" , "Location" , Kind :: Text ) ,
115118 ( "sublocation" , "Sublocation" , Kind :: Text ) ,
@@ -149,7 +152,7 @@ pub const FIELD_GROUPS: &[(&str, &[&str])] = &[
149152 ( "Date" , & [ "captureDate" , "importDate" , "editDate" ] ) ,
150153 ( "Keywords & People" , & [ "keywords" , "keywordCount" , "person" , "personCount" , "faceCount" ] ) ,
151154 ( "Description" , & [ "title" , "caption" , "altText" , "creator" , "copyright" , "usageTerms" , "copyrightStatus" ] ) ,
152- ( "Camera Info" , & [ "camera" , "lens" , "focalLength" , "aperture" , "shutterSpeed" , "iso" ] ) ,
155+ ( "Camera Info" , & [ "camera" , "lens" , "focalLength" , "aperture" , "shutterSpeed" , "iso" , "flash" , "exposureBias" , "cameraSerial" ] ) ,
153156 ( "Location" , & [ "location" , "sublocation" , "city" , "state" , "country" , "countryCode" , "hasGps" ] ) ,
154157 ( "Size" , & [ "longEdge" , "shortEdge" , "width" , "height" , "aspect" , "megapixels" ] ) ,
155158 ( "Develop" , & [ "edited" , "cropped" , "treatment" ] ) ,
@@ -1103,6 +1106,9 @@ impl Rule {
11031106 "editDate" => date_op ( op, p. edited . as_deref ( ) , value) ,
11041107 "shutterSpeed" => num_op ( op, crate :: parse_shutter_seconds ( & m. shutter ) , & shutter_value ( value) ) ,
11051108 "iso" => num_op ( op, m. iso . map ( |v| v as f64 ) , value) ,
1109+ "flash" => yes ( m. flash . unwrap_or ( false ) ) ,
1110+ "exposureBias" => num_op32 ( op, m. exposure_bias , value) ,
1111+ "cameraSerial" => text ( & m. camera_serial ) ,
11061112 "aperture" => num_op32 ( op, m. aperture , value) ,
11071113 "focalLength" => num_op32 ( op, m. focal_mm , value) ,
11081114 "longEdge" | "shortEdge" => {
@@ -1387,6 +1393,21 @@ mod tests {
13871393 yes ( json ! ( { "rules" : [ { "field" : "filePath" , "op" : "isEmpty" } ] } ) ) ;
13881394 yes ( json ! ( { "rules" : [ { "field" : "camera" , "op" : "contains" , "value" : "x2" } , { "field" : "title" , "op" : "isEmpty" } ] } ) ) ;
13891395 yes ( json ! ( { "rules" : [ { "field" : "iso" , "op" : "between" , "value" : [ 800 , 3200 ] } , { "field" : "aperture" , "op" : "lte" , "value" : "f/4" } ] } ) ) ;
1396+ // flash, exposure bias and camera serial (ported from upstream #3821): unrecorded is "no flash", no bias, empty
1397+ no ( json ! ( { "rules" : [ { "field" : "flash" , "op" : "is" , "value" : true } ] } ) ) ;
1398+ no ( json ! ( { "rules" : [ { "field" : "exposureBias" , "op" : "lt" , "value" : 0 } ] } ) ) ;
1399+ no ( json ! ( { "rules" : [ { "field" : "cameraSerial" , "op" : "contains" , "value" : "x2" } ] } ) ) ;
1400+ let mut fl = photo ( 2 ) ;
1401+ fl. meta . flash = Some ( true ) ;
1402+ fl. meta . exposure_bias = Some ( -0.67 ) ;
1403+ fl. meta . camera_serial = "SN-X2" . into ( ) ;
1404+ let flm = |v : serde_json:: Value | rs ( v) . matches ( & fl, & cat) ;
1405+ assert ! ( flm( json!( { "rules" : [ { "field" : "flash" , "op" : "is" , "value" : true } ] } ) ) ) ;
1406+ assert ! ( !flm( json!( { "rules" : [ { "field" : "flash" , "op" : "is" , "value" : false } ] } ) ) ) ;
1407+ assert ! ( flm( json!( { "rules" : [ { "field" : "exposureBias" , "op" : "lt" , "value" : 0 } ] } ) ) ) ;
1408+ assert ! ( flm( json!( { "rules" : [ { "field" : "exposureBias" , "op" : "between" , "value" : [ -1.0 , -0.3 ] } ] } ) ) ) ;
1409+ assert ! ( flm( json!( { "rules" : [ { "field" : "cameraSerial" , "op" : "contains" , "value" : "x2" } ] } ) ) ) ;
1410+ assert_eq ! ( field_group( "exposureBias" ) , Some ( "Camera Info" ) ) ;
13901411 yes ( json ! ( { "rules" : [ { "field" : "megapixels" , "op" : "gte" , "value" : 24 } ] } ) ) ;
13911412 yes (
13921413 json ! ( { "rules" : [ { "field" : "captureDate" , "op" : "is" , "value" : "2026-08" } , { "field" : "captureDate" , "op" : "before" , "value" : "2026-09-01" } ] } ) ,
0 commit comments