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...
Collection
<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");
c.delete(collection=newname);
collections = c.list();
writedump(var=collections,label="Collections after I deleted the new one");
c.optimize(collection="test");
writeoutput("Optimized test");
</cfscript>
Index
<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>
Search
<cfscript>
mysearch = new com.adobe.coldfusion.search();
res = mysearch.search(criteria="cfabort",collection="cfdocs",maxrows=5,status="true");
writedump(var=res);
writeoutput("<hr/>Done");
</cfscript>
Archived Comments
Ray, would you be ok including these in the project/org I just created?
https://github.com/CFCommun...
Everything else in there is licensed under the MIT License, so I would hope you'd be ok licensing your stuff with that as well. MIT is nice because it allows Adobe (or anyone else) to include them in a commercial product... you know... like ColdFusion. ;)
If so, feel free to send a pull request!
I'm fine as long as 'written by Ray' is somewhere in there. I forget if I had that in there or not.
Cool. I'll add them and be sure you're lavishly credited. ;)
Oh yeah, you changed base.cfc... Have you tested to see if it breaks any of the other cfcs that use it? I assume you're using them regularly and already have it overwritten...
Nope, it should not. I'm pretty offended you implied my code may have bugs. (Ahem. ;)
Looking at what your changes were, I feel safe including it. Thanks for the contribution, Ray!
https://github.com/CFCommun...