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 01-03-2013, 07:43 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
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:

Code:
  <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">
      </cfhttp>
Notice that the search engine consumes urls like:

Code:
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,
Tom
anarchos78 is offline   Reply With Quote
Old 01-03-2013, 08:27 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 946
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
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".
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Tags
bluedragon, cfhttp, coldfusion, solr

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 01:00 AM.


Advertisement
Log in to turn off these ads.