Starting Apache Solr #2

リクエスト

 http://localhost:8983/solr/select?indent=on&version=2.2&q=*.*&fq=&start=2&rows=2&fl=id%2Cscore&wt=&explainOther=&hl.fl=
  • indent: XMLのインデント有無
  • version:XMLバージョン
  • q: クエリパラメタ
  • fq: フィルタクエリ(絞り込み)
  • start: 開始番号
  • rows: 取得件数
  • fl: 出力フィールド(schema.xmlでstored=true)
  • wt: レスポンスライタタイプ

レスポンス

wtに何も指定しないとデフォルトでXMLとなる。

<response>
<lst name="responseHeader">

   <!-- 検索処理ステータス 0なら正常 -->
   <int name="status">0</int> 
   
   <!-- Solrでの検索に要した時間(ミリ秒) -->
   <int name="QTime">1</int> 
   
   <!-- リクエストパラメタ -->
   <lst name="params">
      <str name="explainOther"/>
      <str name="fl">id,score</str>
      <str name="indent">on</str>
      <str name="start">2</str>
      <str name="q">*.*</str>
      <str name="hl.fl"/>
      <str name="wt"/>
      <str name="fq"/>
      <str name="version">2.2</str>
      <str name="rows">2</str>
   </lst>
</lst>
</response>

<result name="response" numFound="10" start="2" maxScore="1.0">
  <doc>
    <float name="score">1.0</float>
    <str name="id">MA147LL/A</str>
  </doc>
  <doc>
    <float name="score">1.0</float>
    <str name="id">TWINX2048-3200PRO</str>
  </doc>
</result>

</response>

wtをjsonにするとJSONで出力される。

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "explainOther":"",
      "fl":"id,score",
      "indent":"on",
      "start":"2",
      "q":"*.*",
      "hl.fl":"",
      "wt":"json",
      "fq":"",
      "version":"2.2",
      "rows":"2"}},
  "response":{"numFound":10,"start":2,"maxScore":1.0,"docs":[
      {
        "id":"MA147LL/A",
        "score":1.0},
      {
        "id":"TWINX2048-3200PRO",
        "score":1.0}]
  }}