如何在solrconfig.xml的requestHandler中使用fq

时间:2013-05-20 16:33:06

标签: solr requesthandler

我正在尝试在我的solrconfig.xml文件上设置我的requestHandler以使用fq。所以这是我的代码:

<requestHandler name="/safe" class="com.orestis.custom.solr.handlers.SafeSearchRequestHandler">
    <lst name="defaults">
       <int name="rows">1</int>
       <str name="fl">bookPrice,bookCode,bookAuthor,bookPublishDate</str>
       <str name="fq">bookPublishDate</str>
       <str name="wt">json</str>
       <str name="sort">bookPrice asc</str>
    </lst>

    <lst name="variants">
       <str name="q">*:*</str>
       <str name="printParams">all</str>
    </lst>

    <lst name="allowed">
       <str name="q" />
       <str name="fq" />
       <str name="rows" />
       <str name="wt" />
       <str name="indent" />
       <str name="fl"/>
       <str name="sort"/>
       <str name="sfield"/>
       <str name="pt"/>
       <str name="group"/>
       <str name="group.field"/>
       <str name="group.main"/>
       <str name="group.limit"/>
       <str name="group.sort"/>
       <str name="group.query"/>
       <str name="echoParams"/>
    </lst>  

    <lst name="minMaxList">
       <str name="rows">1,3</str>
     </lst>
  </requestHandler>

当我尝试访问时: http://solr.mysite.com/solr/BookStore/safe?q=fl=bookPrice,bookCode,bookAuthor,bookPublishDate&fq=bookPublishDate:[NOW/HOUR%2B6HOURS%20TO%20*]在我的浏览器上我得到了这个:

{"responseHeader":{"status":0,"QTime":448,"params":{"printParams":"all","fl":"bookPrice,bookCode,bookAuthor,bookPublishDate","sort":"bookPrice asc","q":["*:*","*:*"],"wt":"json","fq":["bookPublishDate:[NOW/HOUR+6HOURS TO *]","bookPublishDate:[NOW/HOUR+6HOURS TO *]"],"rows":"1"}}...response continues

有什么想法为什么我会在回复中得到"bookPublishDate:[NOW/HOUR+6HOURS TO *]"两次?

1 个答案:

答案 0 :(得分:1)

q = fl = bookPrice,bookCode,bookAuthor,bookPublishDate对我来说不对。

尝试http://solr.mysite.com/solr/BookStore/safe?q=*:*&fq=bookPublishDate:\[NOW/HOUR%2B6HOURS%20TO%20*\]