Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • Users who have thanked WolfShade for this post:

    anarchos78 (08-21-2012)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •