Topic
  • 1 reply
  • Latest Post - ‏2013-03-15T17:56:00Z by KaranBal
PoulomiGupta
PoulomiGupta
114 Posts

Pinned topic Fetching category set object from an attribute of category primary spec

‏2013-03-15T17:16:22Z |
Hi,

Is it possible to get a category set object from an attribute of category primary spec.i have tried the below code but getting “not indexed error”. Please suggest.


var catTree = getCategoryTreeByName( 
"Product Categorization Hierarchy " ); var catSet  = catTree.getCategorySetByAttributeValue( 
"PCH Spec/Internal ID",
"10000433"); out.writeln(catSet.size());


PFA screenshot of the Category.
Updated on 2013-03-15T17:56:00Z at 2013-03-15T17:56:00Z by KaranBal
  • KaranBal
    KaranBal
    108 Posts

    Re: Fetching category set object from an attribute of category primary spec

    ‏2013-03-15T17:56:00Z  
    Hi Paulomi,
    This is to be expected. Prior to v-10 FP1, only the indexed attributes(saved in ITA table) were searchable; the non indexed attributes were saved as a blob in ITD table and being saved in binary format, they are not searchable. This was for efficiency of database storage and retrieval and it changed from v-10.0.0FP1 onwards where XML copies of the data was introduced and it became searchable in all attributes.

    Fix:
    In your case, it is clear that the "Internal ID" is not indexed. Just go to the spec console, and make this attribute indexed(it is one of the checkboxes). After doing so, your script should work.

    Suggestion:
    I am not sure whether you can use size() with getCategorySetByAttributeValue. I would suggest making the following change to test your code:
    out.writeln(catSet);

    Potential defect:
    Out of curiosity, I ran your script in an 10.0.0FP3 environment for a non indexed attribute and got the same error as you. I wouldn't have expected this, we should be using XML data for non indexed attributes. This might be a candidate for a defect and would encourage you to open a PMR to ensure this gets analyzed.