Attached to this blog entry are new CFCs that will allow you to perform collection operations (cfcollection, cfindex, and cfsearch) view script based CFCs. From the attached zip, simply store the components in your cfinstall\customtags\com\adobe\coldfusion folder. (Make a backup of base.cfc first!!) The test files are just that - tests. They mainly work with a collection I had called 'test' so you should not expect them to work as is. They are mainly there to provide you with an example. Here are a few examples...


<cfscript> c = new com.adobe.coldfusion.collection();

collections = c.list(); writedump(var=collections,label="Collections, no engine");

clist = c.categoryList(collection="test"); writedump(var=clist,label="Category list for collection test");

//random name newname = "tempcollection_#replace(createUUID(), "-","_","all")#"; c.create(collection=newname,path=server.coldfusion.rootdir & "/collections");

writeoutput("<p>Made #newname#</p>");

collections = c.list(); writedump(var=collections,label="Collections");


collections = c.list(); writedump(var=collections,label="Collections after I deleted the new one");

c.optimize(collection="test"); writeoutput("Optimized test"); </cfscript>


<cfscript> //q is a query I made earlier, ditto for q2 idx = new com.adobe.coldfusion.index(); r = idx.refresh(collection="test",key="id",body="body",query=q,status=true); writeDump(var=r,label="refresh");

writeoutput("size of q2 - adding - #q2.recordCount#<br/>"); r = idx.update(collection="test",key="id",body="body",query=q2,status=true); writeDump(var=r,label="update");

r = idx.delete(collection="test",key=1,status=true); writeDump(var=r,label="delete");

r = idx.purge(collection="test",status=true); writeDump(var=r,label="purge"); </cfscript>


<cfscript> mysearch = new; res ="cfabort",collection="cfdocs",maxrows=5,status="true");

writedump(var=res); writeoutput("<hr/>Done"); </cfscript>

Download attached file.