Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2012, 07:33 PM   PM User | #1
anarchos78
New to the CF scene

 
Join Date: Oct 2011
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
anarchos78 is an unknown quantity at this point
Error when using CFHTTP

Greetings friends,
I have built an app on openBD using CFML. In the app I am using CFHTTP like following:

Code:
<cfcomponent output="false">
<cfprocessingdirective pageencoding="utf-8">
<cfset setEncoding("URL", "utf-8")>

  <cffunction name="search" access="remote" returnType="any" returnFormat="plain">   	  
      <cfargument name="q" type="string" default="" required="yes">       
      <cfargument name="rows" type="string" default="&rows=120" required="yes">   
      <cfargument name="score" type="string" default="&sort=score%20desc" required="yes">
      <cfargument name="highlight" type="string" default="&hl=true" required="yes"> 	 
      <cfargument name="json" type="string" default="&wt=json" required="yes">
      <cfargument name="phrasehighlighter" type="string" default="&hl.usePhraseHighlighter=true" required="yes">
      <cfargument name="filtr" type="string" default="&fq=model:*" required="yes">
      <cfargument name="callbackP" type="string" required="false">
      
      <cfset theUrl = 'http://localhost:8090/solr/ktimatologio/select/?hl.requireFieldMatch=true&hl.fl=*&q=' & #Arguments.q# & #ARGUMENTS.rows# & #ARGUMENTS.score# & #ARGUMENTS.highlight# & #ARGUMENTS.json# & #ARGUMENTS.phrasehighlighter#>
      
      <cfhttp url= "#theUrl#"  result="rs"></cfhttp>
…………………
…………………
…………………
…………………
</cfcomponent>
When I run it I am getting the error: 'Failed to set URL: Invalid query'.

I am damn stuck! What does this error means? I think on Adobe’s CFML engine is working properly, but I am not sure. My "programing" quiver was run out of arrows!.I need to get this working on openBD.
With respect,
Tom
Greece
anarchos78 is offline   Reply With Quote
Old 08-21-2012, 09:19 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 950
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
It appears (to me) that you are setting "q" to equal q, rows, score, highlight, json, and phrasehighlighter. If these are all supposed to have their own name for each value, the string needs to be reformatted. There is also no closing ' for the string (not critical, but I consider it good form to always use a closing string delimiter.)

Also, you can do without the hashmarks, since the values are not contained within "double quotes".

Code:
<cfset theUrl = 'http://localhost:8090/solr/ktimatologio/select/?hl.requireFieldMatch=true&hl.fl=*&q=' & Arguments.q & '&rows=' & ARGUMENTS.rows & '&score=' & ARGUMENTS.score & '&highlight=' & ARGUMENTS.highlight & '&json=' & ARGUMENTS.json & '&phrasehighlighter=' & ARGUMENTS.phrasehighlighter & ''>
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Users who have thanked WolfShade for this post:
anarchos78 (08-21-2012)
Reply

Bookmarks

Tags
cfhttp, cfml, openbd

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:40 AM.


Advertisement
Log in to turn off these ads.