Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 82176 invoked from network); 18 Sep 2010 07:13:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Sep 2010 07:13:05 -0000 Received: (qmail 98344 invoked by uid 500); 18 Sep 2010 07:13:05 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 97307 invoked by uid 500); 18 Sep 2010 07:13:00 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 97300 invoked by uid 99); 18 Sep 2010 07:12:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 07:12:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 07:12:56 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o8I7CYEM026128 for ; Sat, 18 Sep 2010 07:12:34 GMT Message-ID: <20970095.267381284793954303.JavaMail.jira@thor> Date: Sat, 18 Sep 2010 03:12:34 -0400 (EDT) From: "Israel Ekpo (JIRA)" To: dev@lucene.apache.org Subject: [jira] Commented: (SOLR-1967) New Native PHP Response Writer Class In-Reply-To: <20292906.4591277178295498.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SOLR-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910906#action_12910906 ] Israel Ekpo commented on SOLR-1967: ----------------------------------- If you are getting errors when unserializing the response, it means you have control or special characters in the unserialized data that is causing this issue. Try striping out any extra characters before indexing the data. This will get rid of this error. > New Native PHP Response Writer Class > ------------------------------------ > > Key: SOLR-1967 > URL: https://issues.apache.org/jira/browse/SOLR-1967 > Project: Solr > Issue Type: New Feature > Components: clients - php, Response Writers > Affects Versions: 1.4 > Reporter: Israel Ekpo > Fix For: 1.5, 3.1, 4.0, Next > > Attachments: phpnative.tar.gz, phpnativeresponsewriter.jar > > Original Estimate: 0h > Remaining Estimate: 0h > > Hi Solr users, > If you are using Apache Solr via PHP, I have some good news for you. > There is a new response writer for the PHP native extension, currently available as a plugin. > This new feature adds a new response writer class to the org.apache.solr.request package. > This class is used by the PHP Native Solr Client driver to prepare the query response from Solr. > This response writer allows you to configure the way the data is serialized for the PHP client. > You can use your own class name and you can also control how the properties are serialized as well. > The formatting of the response data is very similar to the way it is currently done by the PECL extension on the client side. > The only difference now is that this serialization is happening on the server side instead. > You will find this new response writer particularly useful when dealing with responses for > - highlighting > - admin threads responses > - more like this responses > to mention just a few > You can pass the "objectClassName" request parameter to specify the class name to be used for serializing objects. > Please note that the class must be available on the client side to avoid a PHP_Incomplete_Object error during the unserialization process. > You can also pass in the "objectPropertiesStorageMode" request parameter with either a 0 (independent properties) or a 1 (combined properties). > These parameters can also be passed as a named list when loading the response writer in the solrconfig.xml file > Having this control allows you to create custom objects which gives the flexibility of implementing custom __get methods, ArrayAccess, Traversable and Iterator interfaces on the PHP client side. > Until this class in incorporated into Solr, you simply have to copy the jar file containing this plugin into your lib directory under $SOLR_HOME > The jar file is available here and so is the source code. > Then set up the configuration as shown below and then restart your servelet container > Below is an example configuration in solrconfig.xml > > > > SolrObject > > 0 > > Below is an example implementation on the PHP client side. > Support for specifying custom response writers will be available starting from the 0.9.11 version of the PECL extension for Solr currently available here > http://pecl.php.net/package/solr > Here is an example of how to use the new response writer with the PHP client. > > class SolrClass > { > public $_properties = array(); > public function __get($property_name) { > if (property_exists($this, $property_name)) { return $this->$property_name; } else if (isset($_properties[$property_name])) { return $_properties[$property_name]; } > return null; > } > } > $options = array > ( > 'hostname' => 'localhost', > 'port' => 8983, > 'path' => '/solr/' > ); > $client = new SolrClient($options); > $client->setResponseWriter("phpnative"); > $response = $client->ping(); > $query = new SolrQuery(); > $query->setQuery(":"); > $query->set("objectClassName", "SolrClass"); > $query->set("objectPropertiesStorageMode", 1); > $response = $client->query($query); > $resp = $response->getResponse(); > ?> > > Documentation of the changes to the PECL extension are available here > http://docs.php.net/manual/en/solrclient.construct.php > http://docs.php.net/manual/en/solrclient.setresponsewriter.php > Please contact me at iekpo@php.net, if you have any questions or comments. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org