You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by harshrossi <ha...@gmail.com> on 2014/04/18 08:31:49 UTC

'qt' parameter is not working in search call of SolrPhpClient

I am using SolrPhpClient for interacting with Solr via PHP.

I am using a custom request handler ( /select_test ) with 'edismax' feature
in Solr config file

  <requestHandler name="/select_test" class="solr.SearchHandler">
     <lst name="defaults">
       <str name="echoParams">explicit</str>
       <str name="wt">json</str>
       
       <str name="defType">edismax</str>
       <str name="qf">
          text name topic description
       </str>
       <str name="df">text</str>
       <str name="mm">100%</str>
       <str name="q.alt">*:*</str>
       <str name="rows">10</str>
       <str name="fl">*,score</str>

       <str name="mlt.qf">
          text name topic description
       </str>
       <str name="mlt.fl">text,name,topic,description</str>
       <int name="mlt.count">3</int>
     </lst>
  </requestHandler>

I set the value for 'qt' parameter as '/select_test' in the $search_options
array and pass it as parameter to the search function of the
Apache_Solr_Service as below:

$search_options = array(
    'qt' => '/select_test',
   'fq' => 'topic:games',
   'sort' => 'name desc'
);



$result = $solr->search($query, 0, 100000, $search_options);

It does not call the request handler at all. The call goes to the default
'/select' handler in solr config file.

Just to confirm I put the custom request handler code in default handler and
it worked.

Why is this happening? Am I not setting it right?

Please help!



--
View this message in context: http://lucene.472066.n3.nabble.com/qt-parameter-is-not-working-in-search-call-of-SolrPhpClient-tp4131934.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: 'qt' parameter is not working in search call of SolrPhpClient

Posted by Shawn Heisey <so...@elyograg.org>.
On 4/20/2014 10:50 PM, harshrossi wrote:
> Yes I know but I am using SolrPhpClient API where by default the search()
> function access the '/select' request handler. So I used the 'qt' parameter
> to access '/select_test' as given in this link:
> 
> Non-Default Request Handler
> <http://code.google.com/p/solr-php-client/wiki/FAQ#How_Do_I_Use_A_Non-Default_Request_Handler?>  
> 
> I have used the 'qt' as mentioned in the link but still it points to the
> default '/select'.
> 
> Any suggestions?

In order for qt to work for selecting a handler, you must enable
handleSelect on the requestDispatcher config.  This is no longer
recommended, because you can access *any* request handler this way,
including the /update handler.  This means that the qt parameter can
defeat any security that has been placed in front of Solr to prevent
changing the index.

http://wiki.apache.org/solr/SolrRequestHandler#Old_handleSelect.3Dtrue_Resolution_.28qt_param.29

Thanks,
Shawn


Re: 'qt' parameter is not working in search call of SolrPhpClient

Posted by harshrossi <ha...@gmail.com>.
Yes I know but I am using SolrPhpClient API where by default the search()
function access the '/select' request handler. So I used the 'qt' parameter
to access '/select_test' as given in this link:

Non-Default Request Handler
<http://code.google.com/p/solr-php-client/wiki/FAQ#How_Do_I_Use_A_Non-Default_Request_Handler?>  

I have used the 'qt' as mentioned in the link but still it points to the
default '/select'.

Any suggestions?






--
View this message in context: http://lucene.472066.n3.nabble.com/qt-parameter-is-not-working-in-search-call-of-SolrPhpClient-tp4131934p4132282.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: 'qt' parameter is not working in search call of SolrPhpClient

Posted by Erick Erickson <er...@gmail.com>.
You're confusing a couple of things here. the /select_test can be
accessed by pointing your URL at it rather than using qt, i.e. the
destination you're going to will be
http://server:port/solr/collection/select_test
rather than
http://server:port/solr/collection/select

Best,
Erick

On Thu, Apr 17, 2014 at 11:31 PM, harshrossi <ha...@gmail.com> wrote:
> I am using SolrPhpClient for interacting with Solr via PHP.
>
> I am using a custom request handler ( /select_test ) with 'edismax' feature
> in Solr config file
>
>   <requestHandler name="/select_test" class="solr.SearchHandler">
>      <lst name="defaults">
>        <str name="echoParams">explicit</str>
>        <str name="wt">json</str>
>
>        <str name="defType">edismax</str>
>        <str name="qf">
>           text name topic description
>        </str>
>        <str name="df">text</str>
>        <str name="mm">100%</str>
>        <str name="q.alt">*:*</str>
>        <str name="rows">10</str>
>        <str name="fl">*,score</str>
>
>        <str name="mlt.qf">
>           text name topic description
>        </str>
>        <str name="mlt.fl">text,name,topic,description</str>
>        <int name="mlt.count">3</int>
>      </lst>
>   </requestHandler>
>
> I set the value for 'qt' parameter as '/select_test' in the $search_options
> array and pass it as parameter to the search function of the
> Apache_Solr_Service as below:
>
> $search_options = array(
>     'qt' => '/select_test',
>    'fq' => 'topic:games',
>    'sort' => 'name desc'
> );
>
>
>
> $result = $solr->search($query, 0, 100000, $search_options);
>
> It does not call the request handler at all. The call goes to the default
> '/select' handler in solr config file.
>
> Just to confirm I put the custom request handler code in default handler and
> it worked.
>
> Why is this happening? Am I not setting it right?
>
> Please help!
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/qt-parameter-is-not-working-in-search-call-of-SolrPhpClient-tp4131934.html
> Sent from the Solr - User mailing list archive at Nabble.com.