4 Replies Latest reply on Aug 30, 2010 1:31 PM by areohbee

    Feature Request: catalog:getKeyword

    areohbee Level 5

      Like createKeyword, except without the create.

       

      Plugins sometimes want to know if a particular keyword already exists, without creating it if it doesn't.

       

      Rob

        • 1. Re: Feature Request: catalog:getKeyword
          john beardsworth Adobe Community Professional & MVP

          It might be best if keywords were the same as collections - create either creating a new on or returning the existing one.

           

          John

          • 2. Re: Feature Request: catalog:getKeyword
            areohbee Level 5

            that is how createKeyword works - either creates or returns existing. problem is that I don't always want to create a new one if not existing.

            • 3. Re: Feature Request: catalog:getKeyword
              john beardsworth Adobe Community Professional & MVP

              You sure? I was doing something the other week and thought it didn't.

               

              Create keyword:

              "The new keyword object, or false if a keyword already exists with the same name and parent"

               

              Create collection

              "On success, the new collection object. If a collection with this name already exists, nil or that collection object."

              • 4. Re: Feature Request: catalog:getKeyword
                areohbee Level 5

                Well, I'm no longer sure if we are talking about the same thing.

                 

                catalog:createKeyword will do one of two things:

                 

                1. create a keyword, and return it.

                2. not create a keyword, and return a pre-existing one if its already there with same name.

                 

                I think the difference in collection creation is just that you have the option to return nil vs. an existing, so you can tell whether the collection was actually created. Whereas with keywords there is no way to tell whether a new one was created or if it was already there.

                 

                I'd like to have both capabilities: to know if a new keyword was created or not (like collections), and more importantly for my present needs - the ability to know if the keyword is there without creating it if its not.

                 

                It looks like the collections API is missing this functionality as well, and I bet it would be useful there too - i.e. to test if a collection is available, without necessarily creating it if its not... Although, with collections at least there is a work-around - you could just delete it afterward if you were just checking.

                 

                I'm guessing many people who read this might ask why one would want to check for a collection or keyword if you weren't planning on creating it. In the case of collections, I can imagine writing a plugin that has the option to use a user created collection for something if available, else do things differently... In the case of keywords, one application is to keep from inadvertently creating keywords due to a typo - this is an important feature for some folks trying to keep keyword entry from straying from their keywording conventions.

                 

                Rob