|
79 | 79 | <cfargument name="coreName" type="string" required="true" hint="Solr core name" />
|
80 | 80 |
|
81 | 81 | <cfscript>
|
82 |
| - h = new http(); |
| 82 | + var h = new http(); |
83 | 83 | h.setMethod("get");
|
84 | 84 | h.setURL("#THIS.solrURL#/#ARGUMENTS.coreName#/admin/ping");
|
85 |
| - pingResponse = h.send().getPrefix().statusCode; |
86 |
| - coreCheckResponse = structNew(); |
| 85 | + var pingResponse = h.send().getPrefix().statusCode; |
| 86 | + var coreCheckResponse = structNew(); |
87 | 87 | if (pingResponse eq "200 OK"){
|
88 | 88 | coreCheckResponse.success = true;
|
89 | 89 | coreCheckResponse.statusCode = pingResponse;
|
|
104 | 104 | <cfargument name="schemaName" type="string" required="false" hint="Name of schema file" />
|
105 | 105 |
|
106 | 106 | <cfscript>
|
107 |
| - URLString = "#THIS.host#:#THIS.port#/solr/admin/cores?action=CREATE&name=#ARGUMENTS.coreName#&instanceDir=#instanceDir#"; |
| 107 | + var URLString = "#THIS.host#:#THIS.port#/solr/admin/cores?action=CREATE&name=#ARGUMENTS.coreName#&instanceDir=#instanceDir#"; |
108 | 108 | if (structKeyExists(ARGUMENTS, "dataDir")){
|
109 | 109 | URLString = "#URLString#&dataDir=#ARGUMENTS.dataDir#";
|
110 | 110 | }
|
|
114 | 114 | if (structKeyExists(ARGUMENTS, "schemaName")){
|
115 | 115 | URLString = "#URLString#&schema=#ARGUMENTS.schemaName#";
|
116 | 116 | }
|
117 |
| - newCoreRequest = new http(); |
| 117 | + var newCoreRequest = new http(); |
118 | 118 | newCoreRequest.setMethod("get");
|
119 | 119 | newCoreRequest.setURL("#URLString#");
|
120 |
| - response = newCoreRequest.send().getPrefix(); |
121 |
| - coreCreationResponse = structNew(); |
| 120 | + var response = newCoreRequest.send().getPrefix(); |
| 121 | + var coreCreationResponse = structNew(); |
122 | 122 | if (response.statusCode eq "200 OK"){
|
123 | 123 | coreCreationResponse.success = true;
|
124 | 124 | return coreCreationResponse;
|
|
148 | 148 | <cfset var suggestions = "" />
|
149 | 149 | <cfset var thisSuggestion = "" />
|
150 | 150 | <cfset var iSuggestion = "" />
|
| 151 | + <cfset var currentResult = {} /> |
151 | 152 |
|
152 | 153 | <cfif NOT arrayIsEmpty(ARGUMENTS.facetFields)>
|
153 | 154 | <cfset thisQuery.setFacet(true)>
|
|
225 | 226 | <!--- Remove any leading spaces in the search term --->
|
226 | 227 | <cfset ARGUMENTS.term = "#trim(ARGUMENTS.term)#">
|
227 | 228 | <cfscript>
|
228 |
| - h = new http(); |
| 229 | + var h = new http(); |
229 | 230 | h.setMethod("get");
|
230 | 231 | h.setURL("#THIS.solrURL#/suggest?q=#ARGUMENTS.term#");
|
231 | 232 | local.suggestResponse = h.send().getPrefix().Filecontent;
|
|
234 | 235 | local.wordList = "";
|
235 | 236 | if (ArrayLen(XMLResponse.response.lst) gt 1 AND structKeyExists(XMLResponse.response.lst[2].lst, "lst")){
|
236 | 237 | local.wordCount = ArrayLen(XMLResponse.response.lst[2].lst.lst);
|
237 |
| - For (j=1;j LTE local.wordCount; j=j+1){ |
| 238 | + For (var j=1;j LTE local.wordCount; j=j+1){ |
238 | 239 | if(j eq local.wordCount){
|
239 | 240 | local.resultCount = XMLResponse.response.lst[2].lst.lst[j].int[1].XmlText;
|
240 | 241 | local.resultList = arrayNew(1);
|
241 |
| - For (i=1;i LTE local.resultCount; i=i+1){ |
| 242 | + For (var i=1;i LTE local.resultCount; i=i+1){ |
242 | 243 | arrayAppend(local.resultList, local.wordList & XMLResponse.response.lst[2].lst.lst[j].arr.str[i].XmlText);
|
243 | 244 | }
|
244 | 245 | }else{
|
|
462 | 463 | var thisValueRaw = "";
|
463 | 464 | var thisValueProcessed = "";
|
464 | 465 |
|
465 |
| - if ( isSolrNamedListType(varToParse) ) { |
| 466 | + if ( isSolrNamedListType(arguments.varToParse) ) { |
466 | 467 |
|
467 |
| - for (i=0; i lt varToParse.size(); i=i+1) { |
| 468 | + for (i=0; i lt arguments.varToParse.size(); i=i+1) { |
468 | 469 | try {
|
469 |
| - thisValueRaw = varToParse.getVal(i); |
| 470 | + thisValueRaw = arguments.varToParse.getVal(i); |
470 | 471 | if ( isSolrNamedListType(thisValueRaw) ) { // do we need to call this function recursively? (these lists are often nested.)
|
471 | 472 | thisValueProcessed = parseSolrNamedListType(thisValueRaw);
|
472 | 473 | } else { // just a regular object (that cf knows how to work with)
|
473 | 474 | thisValueProcessed = thisValueRaw;
|
474 | 475 | }
|
475 | 476 | // build the structure to return
|
476 |
| - outSct[varToParse.getName(i)] = thisValueProcessed; |
| 477 | + outSct[arguments.varToParse.getName(i)] = thisValueProcessed; |
477 | 478 | } catch (any e) {
|
478 | 479 | writeLog(
|
479 | 480 | type="information",
|
480 |
| - text="Solr response parsing failed on: " &varToParse.getName(i) &"- " &thisValueRaw.toString() &" type: " &getMetaData(thisValueRaw).getName() |
| 481 | + text="Solr response parsing failed on: " &arguments.varToParse.getName(i) &"- " &thisValueRaw.toString() &" type: " &getMetaData(thisValueRaw).getName() |
481 | 482 | );
|
482 | 483 | }
|
483 | 484 | }
|
|
0 commit comments