Entries Tagged as “ColdFusion Functions”
JSON backward Compatibility: Flag to enable CF8 behavior
ColdFusion | ColdFusion Functions | General | web application | web application development
JSON serialization was introduced in CF8 for the first time. It was used heavily to serialize CFC and other CF data objects. In “CumulativeHotfix1 for ColdFusion 9.0.1”, some of its outstanding issues were fixed. Few of issues addressed in hotfix were that of string to number conversion, and number getting converted to double.
The change in behavior of JSON serialization, which fixed some of the basic problems of CF developer at one hand, also had a side effect of breaking old application built on CF8. Migration from CF8 to later version might require making few changes in the developer’s code.
To achieve backward compatibility and to address a scenario where old behavior of JSON serialization has to be retained, a JVM flag had been introduced at the same time. If enabled, it would bypass the latest changes for JSON serialization and fall back to CF8 behavior.
Here I am describing the JVM flag and the way to enable it. This will bring back the old behavior where a string with leading zero like '000' will be output as 0.0 rather than 000, an invalid number in javascript. Similarly all the number will be retained in double/float format. A number like 1.23E4 will be converted to 12340 and so on. So you can make use of this flag if you have got stuck upgrading to latest CF server.
To achieve the CF8 behavior, one can add a JVM system property json.numberasdouble=true to jvm.config. It is applicable to CF "CumulativeHotfix1 for ColdFusion 9.0.1" and later .
jvm.config file is located at $CF_HOME/cfusion/bin/jvm.config. Open the file and you will find “-Djava.awt.headless=true” as one of the entry in java.args parameters.
Please add the suggested flag just after former headless entry as -Djson.numberasdouble=true.
ColdFusion Functions
ColdFusion | ColdFusion Functions
The following URL provides a complete list of ColdFusion functions arranged alphabetically:
Using the attribute type with Solr collections
ColdFusion | ColdFusion Functions
When you use the tag cfsearch to search Solr collection, the optional attribute type lets you specify the request handlers.
ColdFusion supports the following two request handlers by default.
-
standard: The default request handler.
-
dismax: Useful to process simple user-entered phrases and search for individual words across several fields
Example:
<cfsearch
name = “mySearch”
collection = “myCollection”
criteria = “film”
type=”dismax”
startrow=1
maxrows = “100?>
<cfdump var = “#mySearch#>
Specifying custom request handlers
In addition to standard and dismax, you can specify custom request handlers. To do this, specify the details in the solrconfig.xml available at either of the following location:
· <Collection Directory>/conf
· <Solr Home>/multicore/template/conf
For details of configuration, see the documentation at the following URL: http://wiki.apache.org/solr/SolrRequestHandler