# Did I finally crack it?...



## Johan Elzenga (Jul 9, 2019)

You may remember the famous 'John Smith' keyword problem, discussed here many times. Imagine you have three people, called 'John Smith', 'Jane Smith' and 'John Jones'. You want to create a smart collection that searches for images of John Smith. The problem is that 'Contains John Smith' or 'Contains Words John Smith' does not work, because this wil also find images of Jane Smith and John Jones together. Adding a line 'Does not contain Jones' does not work either, because you may have images of John Smith and John Jones together, and these will now be excluded.

Recently we thought that we found the answer. Instead of using 'Contains John Smith' or 'Contains Words John Smith', you should use 'Start with John Smith'. That will work fine with these three people. Unfortunately however, what we didn't think of was the possibility of a fourth person, called 'John Smithson'. That will break this solution again, because John Smithson starts with John Smith... Sure, this may be a rare example, but it's a possibility nevertheless and it seemed that once again there is no answer.

I believe I finally cracked it and found the ultimate solution. And it's even quite simple! Create a smart collection with two criteria that both must be met:
- Contains Words 'John Smith'
- Start With 'John Smith'

What do you think? Did I finally crack it, or did I still miss something?...


----------



## Jimmsp (Jul 9, 2019)

At first glance, it appears that it should work.


----------



## PhilBurton (Jul 9, 2019)

Jimmsp said:


> At first glance, it appears that it should work.


Would it not be easier to use an underscore to join two keywords, e.g. John_Smith?

Phil


----------



## Johan Elzenga (Jul 9, 2019)

Sure, and you can do that also with a (non-exporting) synonym, so you can search on the synonym and still keep the (exporting) keyword phrase with the space. But the challenge was not to do that and try to find a way to search for 'John Smith' without getting these false positives.


----------



## John Little (Jul 10, 2019)

I don't use Smart Collections, so I may not have it right, but what if the keyword list doesn't Start With "John Smith"? Or does "Start With" mean "any of the keywords starts with"?


----------



## Johan Elzenga (Jul 10, 2019)

John Little said:


> I don't use Smart Collections, so I may not have it right, but what if the keyword list doesn't Start With "John Smith"? Or does "Start With" mean "any of the keywords starts with"?


Any of the keywords assigned to that image. Start with means that one of the the keywords must start with those characters for the image to be found. So if you have an image with the keyword ‘Jane Smith’, then “Contains Smith” will find that image, but “Starts with Smith” will not.


----------



## LouieSherwin (Jul 10, 2019)

This whole problem would be moot if Adobe would simply allow us to search with embedded spaces.  Even Google allows this. 

-end of rant....


----------



## clee01l (Jul 10, 2019)

LouieSherwin said:


> This whole problem would be moot if Adobe would simply allow us to search with embedded spaces.  Even Google allows this.
> 
> -end of rant....


The problem once introduced is not easily overcome.  Adobe converts the criteria list into a standard SQL statement using SQL reserved words such as SELECT, FROM, OR, and  AND.  Some where in the Adobe logic at the time the space between  Keywords was decided to be interpreted as the SQL language reserved word AND.   In the SQL Language SELECT phrases (keyword phrases) are enclosed in quotes.    So that "John Smith" is a complete phrase including the space.  Adobe could recite the conversion of Criteria logic such that the 'Contains' field is enclosed in quotes to that  enclosing quotes are honored in the field such that *"John Smith"* is considered one phrase and *John Smith *is interpreted as two phrases.   However, doing this will break any existing Smart Collection that depends on the space to be interpreted as the SQL AND.


----------

