Support for Collection, Index, and Search operations in Script-Based CFCs

Attached to this blog entry you will find support for adding Solr support to your script based CFCs. These CFCs act like the other tag wrappers in ColdFusion 9 and should be saved to your <cfintall>/customtags/com/adobe/coldfusion folder. Please back up your base.cfc file first! The other files are new. Here’s an example of how your code may look.

<cfscript> c = new com.adobe.coldfusion.collection(); c.create(collection="test2",path=server.coldfusion.rootdir & "/collections");

idx = new com.adobe.coldfusion.index(); //q is a query I made earlier r = idx.refresh(collection=”test2”,key=”id”,body=”body”,query=q,status=true); writeDump(var=r,label=”refresh”);

mysearch = new com.adobe.coldfusion.search(); res = mysearch.search(criteria=”cfabort”,collection=”cfdocs”,maxrows=5,status=”true”); </cfscript> </code>

This code has been submitted to the CF engineering team for a future update, but it had not yet been heavily QAed. Use with caution.<p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments