Hello and welcome to our community! Is this your first visit?
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
    Thanked 0 Times in 0 Posts

    Very strange behaviour with cfhttp an cfhttpparam

    Happy New Year,

    The New Year found me wrestling with a coding problem. I am using ColdFusion and as for CFML engine “openBD”. I have a CFC that handles requests for the

    search engine that I use (SOLR search engine). I am “feeding” that CFC with some arguments. The CFC performs as it should. But when I am trying to pass a

    specific argument (#apofasi_taxonomy #) the CFC doesn’t returns nothing (If I pass the above argument directly to the search engine –not using CFC- I can

    see return/search results)

    Part of CFC:

      <cffunction name="searchP" access="remote" returnFormat="json">         
          <cfargument name="q" type="string" default="" required="yes"> 
          <cfargument name="apofasi_taxonomy" type="string" default="apofasi_taxonomy:(*)" required="yes">
          <cfargument name="apofasi_tmima" type="string" default="apofasi_tmima:(*)" required="yes">
          <cfargument name="apofasi_date" type="string" default="apofasi_date:(*)" required="yes">  
          <cfargument name="apofasi_number" type="string" default="apofasi_number:(*)" required="yes"> 
          <!---<cfargument name="apofasi_taxonomy" type="string" default="*">
          <cfargument name="apofasi_tmima" type="string" default="*">
          <cfargument name="apofasi_date" type="string" default="*">  
          <cfargument name="apofasi_number" type="string" default="*">--->
          <cfset theUrl = 'http://localhost/solr/areios_pagos/select/?'>
          <cfhttp method="get" url="#theUrl#" port="8090" result="rs" username="abcd" password="********">
            <cfhttpparam type="url" name="q" value="#q#">
            <cfhttpparam type="url" name="fq" value="#apofasi_taxonomy#+#apofasi_tmima#+#apofasi_date#+#apofasi_number#">
            <!---<cfhttpparam type="url" name="fq" value="apofasi_taxonomy:(3068 || ΠΟΙΝΙΚΕΣ) AND apofasi_date:(2010)">--->        
            <!---<cfhttpparam type="url" name="fq" value="apofasi_taxonomy:(3068) AND apofasi_date:(*) AND apofasi_number:(*)">--->
            <cfhttpparam type="url" name="rows" value="120">
            <cfhttpparam type="url" name="wt" value="json">
            <cfhttpparam type="url" name="sort" value="score desc">
            <cfhttpparam type="url" name="hl" value="true">
            <cfhttpparam type="url" name="hl.fl" value="content,title">
            <cfhttpparam type="url" name="fl" value="grid_title,title,url,ida,model,search_tag,solr_id">
            <cfhttpparam type="url" name="f.content.hl.alternateField" value="content">
            <cfhttpparam type="url" name="hl.maxAlternateFieldLength" value="800">
    Notice that the search engine consumes urls like:

    http://localhost/solr/areios_pagos/select/?q=blahblah&fq=apofasi_taxonomy:(3068)+apofasi_tmima:(Α || Ζ)+apofasi_date:(2007 || 2012)+apofasi_number:(666)
    What I have checked until now: The arguments that I am passing to CFC are 100% OK (from html), I have double-checked if the search engine can consume the

    above url syntax. But I have noticed a very strange behavior. When I exclude the #apofasi_taxonomy# or #apofasi_tmima# arguments from the

    url completely the CFC is working (it returns results). The values that #apofasi_taxonomy# argument takes are: apofasi_taxonomy\:\(ΠΟΙΝΙΚΕΣ), apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ), apofasi_taxonomy\:\(3068) or apofasi_taxonomy\:\(ΠΟΙΝΙΚΕΣ || 3068), apofasi_taxonomy\:\(ΠΟΙΝΙΚΕΣ || ΠΟΛΙΤΙΚΕΣ) and so on.

    I have noticed one more thing, #apofasi_taxonomy# argument is working with the values below: apofasi_taxonomy\:\(ΠΟΙΝΙΚΕΣ), apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ) and apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ || ΠΟΙΝΙΚΕΣ) but it is not working for apofasi_taxonomy\:\(3068), apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ || 3068), apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ || 3068) or apofasi_taxonomy\:\(ΠΟΛΙΤΙΚΕΣ || ΠΟΛΙΤΙΚΕΣ || 3068). Isn’t that weird?

    The values that #apofasi_tmima# argument takes are: Α || Α1 || Α2 || Β || Β2 || Γ || Δ || Ε || ΣΤ || Ζ || ΟΛΟΜΕΛΕΙΑ e.g. apofasi_tmima\:\(Β || Β2 || ΟΛΟΜΕΛΕΙΑ).

    Keep in mind that the above values are in Greek language.

    Is there anyone out there that can help?

    With respect,

  2. AdSlot6
  3. #2
    Regular Coder
    Join Date
    Apr 2012
    St. Louis, MO
    Thanked 101 Times in 101 Posts
    Have you tried #URLEncodedFormat()# on the values?

    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".


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