Skip to content

Commit

Permalink
Change SearchExpression context from tokenized to exact
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkrz committed May 24, 2023
1 parent 7454a0f commit e512f0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Core/Provider/Cloudinary/Resolver/SearchExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static function (&$value, $key) { $value = is_array($value) ? $value : [$value];

$newContext = [];
foreach ($context as $key => $values) {
$newContext[] = ('(context.' . $key . ':"' . implode('" OR context.' . $key . ':"', $values) . '")');
$newContext[] = ('(context.' . $key . '="' . implode('" OR context.' . $key . '="', $values) . '")');
}

return '(' . implode(' AND ', $newContext) . ')';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function dataProvider(): array
folders: ['root/images/1', 'root/videos/2'],
context: ['type' => ['product_image', 'category_image'], 'source' => 'user_upload'],
),
'(folder:"root/images/1" OR folder:"root/videos/2") AND ((context.type:"product_image" OR context.type:"category_image") AND (context.source:"user_upload"))',
'(folder:"root/images/1" OR folder:"root/videos/2") AND ((context.type="product_image" OR context.type="category_image") AND (context.source="user_upload"))',
],
[
new Query(remoteIds: ['upload|image|root/test/picture1', 'upload|image|root/test/picture2', 'upload|image|root/test/picture3']),
Expand Down Expand Up @@ -89,7 +89,7 @@ public static function dataProvider(): array
. ' AND (((!format="aac") AND (!format="aiff") AND (!format="amr") AND (!format="flac") AND (!format="m4a")'
. ' AND (!format="mp3") AND (!format="ogg") AND (!format="opus") AND (!format="wav") AND (!format="pdf")'
. ' AND (!format="doc") AND (!format="docx") AND (!format="ppt") AND (!format="pptx") AND (!format="txt")))'
. ' AND ((context.source:"user_upload"))',
. ' AND ((context.source="user_upload"))',
],
[
new Query(visibilities: ['public']),
Expand Down Expand Up @@ -156,7 +156,7 @@ public static function dataProvider(): array
. ' AND (tags:"tech" OR tags:"nature")'
. ' AND (public_id:"root/test/picture1" OR public_id:"root/test/picture2" OR public_id:"root/test/picture3")'
. ' AND (etag="hash1" OR etag="hash2")'
. ' AND ((context.original_filename:"picture_*") AND (context.type:"product_image" OR context.type:"category_image"))',
. ' AND ((context.original_filename="picture_*") AND (context.type="product_image" OR context.type="category_image"))',
],
];
}
Expand Down

0 comments on commit e512f0f

Please sign in to comment.