After creating & putting a new category / subcategory for a schema, what must happen to be able to apply the subCategory to an asset via ramAsset.categorize(subCategory). For example do I need to wait for an index to be rebuilt. I am adding & applying subcategories on the fly.
I am getting a RAMRuntime exception "Subcategory <schema>/<category>/<subcategory> was not found for the asset <asset name>http://1.0." Ive tried waiting 5 mins (twice my index frequency). I can retrieve the subcategory from the schema, (& it is being persisted, its in the GUI).
Any ideas - or am i doing somthing silly?
Pinned topic Creating & applying subcategories on the fly.
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-06-30T21:20:04Z at 2010-06-30T21:20:04Z by land-land
land-land 270001PJ2212 Posts
Re: Creating & applying subcategories on the fly.2010-06-30T21:20:04ZThis is the accepted answer. This is the accepted answer.I believe the behaviour is as follows:
- schema.create(category) + put() returns update successful but the category cannot be applied to an asset until next index completes. The create() is genuinely successful, but just needs a delay before the category can be used..
- category.createSubCategory(subCategory) + put() returns update successful but the subCategory cannot be used unless the createSubCategory() was called after the index following the create(category). If called before the reindex, the createSubCategory status is in error, the subcategory is never usable. This means a createSubCategory() takes 2 index cycles to be usable, if you have to create the category as well.
One extra dimension seems to be if you happen to have a GUI window open on the category scheme, using the browser refresh to see the results of the operations, then createSubCategory() never appears on the page unless the page cancel button is pressed and the schema reloaded through the category schema name link. I ack this is a minor point.
If anybody has a way to make it work on the fly – i would appreciate the suggestions.