panjiwa10028 / solr-php-client

Automatically exported from code.google.com/p/solr-php-client
Other
0 stars 0 forks source link

Add support to set search servlet [other than "select"] #97

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using? On what operating system?
solr 3.6.2 on ubuntu

I add feature to use customize search servlet. In my case it is "myservlet". my 
complete url to search is -
http://localhost:8983/solr/myservlet?q=A1N00C&rows=2&start=17

I add following methods to implement above feature into Service.php -
    private $search_servlet;
    public function setSearchServlet($p_search_servlet){
        $this->search_servlet=$p_search_servlet;
        $this->_initUrls();
    }
    protected function getSearchServlet(){
        if(empty($this->search_servlet)) $this->search_servlet='select';
        return $this->search_servlet;
    }

I remove following constant -
self::SEARCH_SERVLET

Finally when need search servlet I call $this->getSearchServlet();

That's all. Hope you may add above feature into your project.

I attached new Service.php file

Thanks

Original issue reported on code.google.com by shkha...@gmail.com on 23 Mar 2014 at 10:34

Attachments:

GoogleCodeExporter commented 8 years ago
The more general way to do this (that's already supported) is to give your 
search configuration a straight name rather than an url in your solr config. An 
example of this is the dismax search handler in the default config provided 
with the solr distribution. Then instead of setting a URL, you can use the same 
select URL with different qt parameter.

This is in the FAQ: 
https://github.com/PTCInc/solr-php-client/wiki/FAQ#how-do-i-use-a-non-default-re
quest-handler

I probably wont' accept this patch as is, but thank you for trying to improve 
the client. In the future, if you bring it up on the mailing list first, we can 
point you to solutions before you feel the need to make changes.

Original comment by donovan....@gmail.com on 23 Mar 2014 at 7:32