Highlighted

categoryTree always empty

Community Beginner ,
Jan 20, 2015

Copy link to clipboard

Copied

I am having difficulty getting categoryTree to populate with cfindex. I have created the collection with categories enabled, and the category column does indeed get populated. But try as I might, I cannot get the categoryTree column to populate. My indexing code is as follows:

cfindex(
     type="custom",
     autoCommit=true,
     collection=arguments.collectionName,
     action="Update",
     key=arguments.key,
     title=arguments.title,
     body=arguments.body,
     custom1=arguments.custom1,
     custom2=arguments.custom2,
     custom3=arguments.custom3,
     custom4=DateConvert( 'Local2UTC', now() ),
     category=arguments.categories,
     categoryTree=arguments.categoryTree,
     status="statusStruct");

The results of cfsearch do contain values in the category column, and listing the categories using new collection().categorylist(); shows the categories, but again no categoryTrees. I have deleted the collection and recreated it several times, including stopping the ColdFusion Add-On service and deleting the collection files. I have also created new collections with different names and paths, but I still have this issue every time I index any collection.

There seems to be very few people who have had such an issue since I have found very little online concerning the problem (namely, people saying it worked after they deleted and recreated the collection, and a bug submitted to Adobe - which was subsequently closed when Adobe couldn't replicate the issue). Does anyone have any ideas of what I can try?

For reference, I am using CF 11 on Windows 7 using IIS for my server.

Correct answer by jgarrett1 | Community Beginner

After an exchange with the ever knowledgeable Ray Camden, I have pinpointed the issue.

Ray sent me the following code to test:

q = queryNew("id,title,body,cat,leaf", "integer,varchar,varchar,varchar,varchar");
q.addRow({id:1,title:"Title1", body:"I like cats", cat:"sports", leaf:"football"});
q.addRow({id:2,title:"Title2", body:"I like dogs", cat:"sports", leaf:"tennis"});
q.addRow({id:3,title:"Title3", body:"I like tech", cat:"news", leaf:"tech"});

writedump(q);

cfindex(
     type="custom",
     autoCommit=true,
     collection="test1",
     action="update",
     key="id",
     title="title",
     body="body",
     category="leaf",
     categoryTree="cat",
     query="q",
     status="statusStruct");

writedump(statusStruct);

cfsearch(collection="test1", criteria="cats", categorytree="sports", name="r");

writedump(r);

This code does indeed produce categoryTree results. So, why does this code work and my code doesn't?

If you look carefully there is one thing I don't do that ray does. While I use cfindex > type="custom" without a query parameter, Ray puts his data into a query before calling cfindex > type="custom" with a query parameter.

I have been using type="custom" without a query for a while and never had a problem... but I also wasn't using categoryTree. So it seems while using cfindex > type="custom" without a query works for most things, it doesn't support categoryTree. I don't know if this is a bug, or a reflection of the fact that perhaps we shouldn't be using type="custom" without a query.

An additional note I have is that there was a bug submitted to Adobe last year that raised this exact issue (https://bugbase.adobe.com/index.cfm?event=bug&id=3785874). Now that I know what the problem is, I find it frustrating that the Adobe tech who responded to that ticket obviously didn't test the code that was submitted. If they had, they would have been able to replicate the issue.

I don't know if using categoryTree with type="custom", but without a query, worked prior to CF 10. But it definitely doesn't work from 10 forward. Some clarification from Adobe as to whether this is a bug, or improper use by the developer, would be appreciated.

Hopefully someone out there will find this helpful some day.

John

Views

407

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

categoryTree always empty

Community Beginner ,
Jan 20, 2015

Copy link to clipboard

Copied

I am having difficulty getting categoryTree to populate with cfindex. I have created the collection with categories enabled, and the category column does indeed get populated. But try as I might, I cannot get the categoryTree column to populate. My indexing code is as follows:

cfindex(
     type="custom",
     autoCommit=true,
     collection=arguments.collectionName,
     action="Update",
     key=arguments.key,
     title=arguments.title,
     body=arguments.body,
     custom1=arguments.custom1,
     custom2=arguments.custom2,
     custom3=arguments.custom3,
     custom4=DateConvert( 'Local2UTC', now() ),
     category=arguments.categories,
     categoryTree=arguments.categoryTree,
     status="statusStruct");

The results of cfsearch do contain values in the category column, and listing the categories using new collection().categorylist(); shows the categories, but again no categoryTrees. I have deleted the collection and recreated it several times, including stopping the ColdFusion Add-On service and deleting the collection files. I have also created new collections with different names and paths, but I still have this issue every time I index any collection.

There seems to be very few people who have had such an issue since I have found very little online concerning the problem (namely, people saying it worked after they deleted and recreated the collection, and a bug submitted to Adobe - which was subsequently closed when Adobe couldn't replicate the issue). Does anyone have any ideas of what I can try?

For reference, I am using CF 11 on Windows 7 using IIS for my server.

Correct answer by jgarrett1 | Community Beginner

After an exchange with the ever knowledgeable Ray Camden, I have pinpointed the issue.

Ray sent me the following code to test:

q = queryNew("id,title,body,cat,leaf", "integer,varchar,varchar,varchar,varchar");
q.addRow({id:1,title:"Title1", body:"I like cats", cat:"sports", leaf:"football"});
q.addRow({id:2,title:"Title2", body:"I like dogs", cat:"sports", leaf:"tennis"});
q.addRow({id:3,title:"Title3", body:"I like tech", cat:"news", leaf:"tech"});

writedump(q);

cfindex(
     type="custom",
     autoCommit=true,
     collection="test1",
     action="update",
     key="id",
     title="title",
     body="body",
     category="leaf",
     categoryTree="cat",
     query="q",
     status="statusStruct");

writedump(statusStruct);

cfsearch(collection="test1", criteria="cats", categorytree="sports", name="r");

writedump(r);

This code does indeed produce categoryTree results. So, why does this code work and my code doesn't?

If you look carefully there is one thing I don't do that ray does. While I use cfindex > type="custom" without a query parameter, Ray puts his data into a query before calling cfindex > type="custom" with a query parameter.

I have been using type="custom" without a query for a while and never had a problem... but I also wasn't using categoryTree. So it seems while using cfindex > type="custom" without a query works for most things, it doesn't support categoryTree. I don't know if this is a bug, or a reflection of the fact that perhaps we shouldn't be using type="custom" without a query.

An additional note I have is that there was a bug submitted to Adobe last year that raised this exact issue (https://bugbase.adobe.com/index.cfm?event=bug&id=3785874). Now that I know what the problem is, I find it frustrating that the Adobe tech who responded to that ticket obviously didn't test the code that was submitted. If they had, they would have been able to replicate the issue.

I don't know if using categoryTree with type="custom", but without a query, worked prior to CF 10. But it definitely doesn't work from 10 forward. Some clarification from Adobe as to whether this is a bug, or improper use by the developer, would be appreciated.

Hopefully someone out there will find this helpful some day.

John

Views

408

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 20, 2015 0
Community Beginner ,
Feb 12, 2015

Copy link to clipboard

Copied

After an exchange with the ever knowledgeable Ray Camden, I have pinpointed the issue.

Ray sent me the following code to test:

q = queryNew("id,title,body,cat,leaf", "integer,varchar,varchar,varchar,varchar");
q.addRow({id:1,title:"Title1", body:"I like cats", cat:"sports", leaf:"football"});
q.addRow({id:2,title:"Title2", body:"I like dogs", cat:"sports", leaf:"tennis"});
q.addRow({id:3,title:"Title3", body:"I like tech", cat:"news", leaf:"tech"});

writedump(q);

cfindex(
     type="custom",
     autoCommit=true,
     collection="test1",
     action="update",
     key="id",
     title="title",
     body="body",
     category="leaf",
     categoryTree="cat",
     query="q",
     status="statusStruct");

writedump(statusStruct);

cfsearch(collection="test1", criteria="cats", categorytree="sports", name="r");

writedump(r);

This code does indeed produce categoryTree results. So, why does this code work and my code doesn't?

If you look carefully there is one thing I don't do that ray does. While I use cfindex > type="custom" without a query parameter, Ray puts his data into a query before calling cfindex > type="custom" with a query parameter.

I have been using type="custom" without a query for a while and never had a problem... but I also wasn't using categoryTree. So it seems while using cfindex > type="custom" without a query works for most things, it doesn't support categoryTree. I don't know if this is a bug, or a reflection of the fact that perhaps we shouldn't be using type="custom" without a query.

An additional note I have is that there was a bug submitted to Adobe last year that raised this exact issue (https://bugbase.adobe.com/index.cfm?event=bug&id=3785874). Now that I know what the problem is, I find it frustrating that the Adobe tech who responded to that ticket obviously didn't test the code that was submitted. If they had, they would have been able to replicate the issue.

I don't know if using categoryTree with type="custom", but without a query, worked prior to CF 10. But it definitely doesn't work from 10 forward. Some clarification from Adobe as to whether this is a bug, or improper use by the developer, would be appreciated.

Hopefully someone out there will find this helpful some day.

John

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 12, 2015 0