Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

catalog:createSmartCollection and filename with spaces

New Here ,
Jun 13, 2025 Jun 13, 2025

I'm creating smart collection with a list of files:

 

local function stringifyPhotoList( photoList )
	return table.concat(photoList, ", ")
end

[...]

local searchDesc = {
	criteria = "filename",
	operation = "any",
	value = stringifyPhotoList(photos),
}
catalog:createSmartCollection(subColName, searchDesc, newParentColSet)

 
filenames are separated with commas.

 

Everything works fine - I have smart collection with selected photos.

 

Expect one case - when filenames contain spaces - then it starts matching a lot more photos than it should.

 

I don't know how can I handle such case. I tried enclosing filenames in parentheses or apostrophies - it does not help.

TOPICS
SDK
91
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 13, 2025 Jun 13, 2025

Unfortunately, there's no good solution. Adobe inexplicably omitted "exact match" from smart collections and text filters.  You used to be able to do 

All of
    filename starts with xxx yyy zzz
    filename ends with xxx yyy zzz

but that broke in LR 13.3. 

 

If your end goal is to find files given a list of file names, you could use the Any Filter plugin's "matches lines" operator:

johnrellis_0-1749834650658.png

 

If your goal is to write a plugin that provides that functionality, the plugin could call catalog:getAllPhotos() and t

...
Translate
LEGEND ,
Jun 13, 2025 Jun 13, 2025
LATEST

Unfortunately, there's no good solution. Adobe inexplicably omitted "exact match" from smart collections and text filters.  You used to be able to do 

All of
    filename starts with xxx yyy zzz
    filename ends with xxx yyy zzz

but that broke in LR 13.3. 

 

If your end goal is to find files given a list of file names, you could use the Any Filter plugin's "matches lines" operator:

johnrellis_0-1749834650658.png

 

If your goal is to write a plugin that provides that functionality, the plugin could call catalog:getAllPhotos() and then catalog:batchGetRawMetadata () to get the photos' file names. It could create a temporary collection in which to store the matching photos.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines