I've gotten around this by doing initialization via LrInitPlugin that builds a map for quick access.
This was my first try at an email-based response - it worked but there was an unexpected delay - thus the subsequent post below...
I've gotten around this by using LrInitPlugin to build a keyword map for quick access.
PS - what would the "id/LocalIdentifier" be in your example?
this what I'm doing currently as well - to make a map during plugin startup. The problem of this "method" is that it takes 5min and it must be done everytime to really ensure that no keywords have been created outside the plugin.
In my map I store the name of the keyword and the LrKeyword object. Whenever the catalog, e.g. was optimized or new keywords have been created, then the stored LrKeyword object instances seems to be inaccurate and not working. So my idea would be to have the map (a findKeyword function would be so much better...) and not to store the LrKeyword object but the identifier which is unique in any case. I mean, LR provides the keyword.localIdentifier varaible but there is no useful way to work with it...
I see: +1 vote then...
I think it would be simpler for everyone if Adobe were to provide a method catalog:getAllKeywords () that returned an array of all the keywords. There's no engineering challenge in doing that -- it would surely execute faster than the 15 msecs it currently takes to invoke any one of the LrKeyword methods. You can get a feel for how fast it should be by invoking Metadata > Export Keywords.
Sound like a good idea.
Another +1 vote - this is becoming a real pain for me and my KeywordConsolidator plugin.