3

CFMLを使用してopenBDでアプリを作成しました。アプリでは、次のようにCFHTTPを使用しています。

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

実行すると、次のエラーが発生します:'URLの設定に失敗しました:無効なクエリ'

行き詰まっている!このエラーはどういう意味ですか?AdobeのCFMLエンジンは正常に機能していると思いますが、よくわかりません。私の「プログラミング」矢筒は矢印を使い果たしました!.openBDでこれを機能させる必要があります。

に関して、

トム

ギリシャ

4

1 に答える 1

4

method引数が必要です(またはのいずれGETPOSTで、ポートを削除する必要があります。次のように、ポートをport属性としてタグに追加します。

<cfset theUrl = 'http://localhost:8090/solr/ktimatologio...' />
<cfhttp method="get" url="#theURL#" port="8090" result="rs>

cfhttpparamまた、次のように、URLに追加するのではなく、これらのクエリ文字列値をすべてタグとして追加することをお勧めします。

<cfset theUrl = 'http://localhost/solr/ktimatologio/select/>
<cfhttp method="get" url="#theURL#" port="8090" result="rs>
    <cfhttpparam type="URL" name="q" value="#Arguments.q#" />
    <cfhttpparam type="URL" name="wt" value="#Arguments.JSON" />
    .... more params ....
</cfhttp>

また、引数からクエリ文字列名を削除することを強くお勧めします。実装を変更することにした場合は、問題が発生します...各クエリ文字列値に指定する値を受け入れるだけで、値自体の名前は受け入れません。

于 2012-08-21T19:53:28.583 に答える