Re: svn commit: r808988 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/request/PHPSerializedResponseWriter.java
you are correct, it was my misunderstanding of the problem - now that I've read more than I ever wanted to know about UCS-2, UTF-16 and modified UTF-8, I'm more upto speed. Thanks for the patience. On Sep 11, 2009, at 6:32 PM, Yonik Seeley wrote: On Fri, Sep 11, 2009 at 6:21 PM, Donovan Jimenez djime...@conduit-it.com wrote: Is it possible (and would it even help) to normalize all strings with regards to surrogate pairs at indexing time instead? Already done, in a way... there's only one way to represent a character outside the BMP in UTF-16 (which is the in-memory encoding used by Java String). Unless I misunderstood what you meant by normalization. -Yonik http://www.lucidimagination.com
[jira] Commented: (SOLR-1270) Legacy Numeric Field types need to be more consistent in their input/output error checking documentation
[ https://issues.apache.org/jira/browse/SOLR-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12739152#action_12739152 ] Donovan Jimenez commented on SOLR-1270: --- Yonik has already started standardizing output time checking. So keep going there and we're good. The trunk example schema now uses Trie fields for the default numeric types with precisionStep of 0. This should be fine since this seems to be the preferred / suggested field type implementations. The main idea of our argument was that the default make sense for the new user - I believe that change accomplishes this. So again, we're good. I also see new comments about which example field types are considered legacy - good. The Trie field also mentions a little about how it generates tokens which can help when examining the index with tools like luke - a point of confusion that matt mentioned - so again, good. The sortable numeric definitions might benefit from similar info in the comments. Probably the only thing I could offer as a suggestion. Personally, I think you could remove more of the unused configuration from the example, but that's subjective opinion - some people like adding to a minimum, others like to prune from a maximum. I think that solr as a community is of the let them prune persuasion. Legacy Numeric Field types need to be more consistent in their input/output error checking documentation -- Key: SOLR-1270 URL: https://issues.apache.org/jira/browse/SOLR-1270 Project: Solr Issue Type: Bug Components: search Affects Versions: 1.2, 1.3, 1.4 Environment: ubuntu 8.04, sun java 6, tomcat 5.5 Reporter: Donovan Jimenez Assignee: Yonik Seeley Priority: Minor Fix For: 1.4 Attachments: SOLR-1270.patch FloatField, IntField, ByteField, LongField. and DoubleField have inconsistent behavior at response writing time when dealing with garbage data in the index. the behavior should be standardized, and better documented. -- This issue originally came from my php client issue tracker: http://code.google.com/p/solr-php-client/issues/detail?id=13 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-1270) The FloatField (and probably others) field type takes any string value at index, but JSON writer outputs as numeric without checking
[ https://issues.apache.org/jira/browse/SOLR-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12734358#action_12734358 ] Donovan Jimenez commented on SOLR-1270: --- I'm preferential to doing the check at add document time if one is going to be done at all because it fails early for the user. However, I have a counter proposal to changing the FloatField type. Since FloatField is meant primarily for legacy purposes, why don't we change the distributed example schema.xml to not use it for the float field type. If we're going for the 80/20 type mantra, then SortableFloatField is probably what most new users of Solr mean when they want to specify a float field. Does that seem like a workable idea to try and remove the confusion around this issue? The FloatField (and probably others) field type takes any string value at index, but JSON writer outputs as numeric without checking Key: SOLR-1270 URL: https://issues.apache.org/jira/browse/SOLR-1270 Project: Solr Issue Type: Bug Components: search Affects Versions: 1.2, 1.3, 1.4 Environment: ubuntu 8.04, sun java 6, tomcat 5.5 Reporter: Donovan Jimenez Priority: Minor Fix For: 1.4 Attachments: SOLR-1270.patch The FloatField field type takes any string value at index. These values aren't necessarily in JSON numeric, but the JSON writer does not check its validity before writing it out as a JSON numeric. I'm aware of the SortableFloatField which does do index time verification and conversion of the value, but the way the JSON writer is working seemed like either a bug that needed addressed or perhaps a gotch that needs better documented? This issue originally came from my php client issue tracker: http://code.google.com/p/solr-php-client/issues/detail?id=13 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: Dependency Injection?
guice and spring are trying to standardize those annotations through the JCP to try and eliminate the tie in with a particular DI framework (minus the actual configuration). Bob lee has a post about it (developer of Guice): http://crazybob.org/2009/05/announcing-javaxinjectinject.html So using guice annotations now would be transitional to standard annotations later theoretically. Of course, that's assuming the momentum keeps moving forward with their submission. On Jul 14, 2009, at 5:30 PM, Mark Miller wrote: On Tue, Jul 14, 2009 at 5:06 PM, Jason Rutherglen jason.rutherg...@gmail.com wrote: Are we looking at implementing dependency injection for the config files? I'd like to think about this as we also look at integrating Zookeeper for config file management. I was trying (for example) to use LogByteSizeMergePolicy however currently I can't set the parameters because solrconfig.xml only accepts a class name. Adding custom dependency injection just for this class doesn't seem ideal, nor is rolling out our own dependency injection? There's a couple of choices: * Spring - It's in wide use, however it grows brittle and very difficult to maintain over time. I'd personally rather focus on search, not managing webs of xml files. Some companies have extended Spring to get around other limitations, I don't think we want to go down that path? * Guice http://code.google.com/p/google-guice/ Pluses: Apache Licensed and it's integrated with Java so there's no problems with misspellings, type safety. Because it's in Java it gets around Spring's biggest drawback to me which is the inability to easily navigate the XML files. We have discussed a few times in the past. A nice benefit is that, while we can provide an injector framework with Solr, it should be easy to plugin another (though not necessarily with annotations) of your own choosing. I liked Guice a lot when I used it a couple years back - wasn't it annotation only though? Not sure I like the idea of Guice annotations all throughout Solr. Noble has started some work towards this by beginning to move all of the solrconfig parsing to one class. Ryan also did some work towards this, and I think there is a branch with his work, though I'm sure its way out of date now. -- -- - Mark http://www.lucidimagination.com
[jira] Created: (SOLR-1270) The FloatField (and probably others) field type takes any string value at index, but JSON writer outputs as numeric without checking
The FloatField (and probably others) field type takes any string value at index, but JSON writer outputs as numeric without checking Key: SOLR-1270 URL: https://issues.apache.org/jira/browse/SOLR-1270 Project: Solr Issue Type: Bug Components: search Affects Versions: 1.3, 1.2, 1.4 Environment: ubuntu 8.04, sun java 6, tomcat 5.5 Reporter: Donovan Jimenez Priority: Minor The FloatField field type takes any string value at index. These values aren't necessarily in JSON numeric, but the JSON writer does not check its validity before writing it out as a JSON numeric. I'm aware of the SortableFloatField which does do index time verification and conversion of the value, but the way the JSON writer is working seemed like either a bug that needed addressed or perhaps a gotch that needs better documented? This issue originally came from my php client issue tracker: http://code.google.com/p/solr-php-client/issues/detail?id=13 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-1091) phps (serialized PHP) writer produces invalid output
[ https://issues.apache.org/jira/browse/SOLR-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12706458#action_12706458 ] Donovan Jimenez commented on SOLR-1091: --- the character sequence specified seems to be windows 1251 - based on just getting it to look like what's in the description in a text editor. I see it getting the utf-8 byte length now, but is the output writer guaranteed to be outputting in utf-8? sorry if it's a naive question, I do see the content-type is text/plain; charset=utf-8 - does that change the output writer's encoding? if it IS guaranteed, then maybe its how the character data is added - i.e. the add xml was interpreted utf-8 but the data was actually windows-1251 or similar. phps (serialized PHP) writer produces invalid output -- Key: SOLR-1091 URL: https://issues.apache.org/jira/browse/SOLR-1091 Project: Solr Issue Type: Bug Components: search Affects Versions: 1.3 Environment: Sun JRE 1.6.0 on Centos 5 Reporter: frank farmer Priority: Minor Fix For: 1.4 The serialized PHP output writer can outputs invalid string lengths for certain (unusual) input values. Specifically, I had a document containing the following 6 byte character sequence: \xED\xAF\x80\xED\xB1\xB8 I was able to create a document in the index containing this value without issue; however, when fetching the document back out using the serialized PHP writer, it returns a string like the following: s:4:􀁸; Note that the string length specified is 4, while the string is actually 6 bytes long. When using PHP's native serialize() function, it correctly sets the length to 6: # php -r 'var_dump(serialize(\xED\xAF\x80\xED\xB1\xB8));' string(13) s:6:􀁸; The wt=php writer, which produces output to be parsed with eval(), doesn't have any trouble with this string. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (SOLR-1091) phps (serialized PHP) writer produces invalid output
[ https://issues.apache.org/jira/browse/SOLR-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12706458#action_12706458 ] Donovan Jimenez edited comment on SOLR-1091 at 5/6/09 8:32 AM: --- the character sequence specified seems to be windows 1252 - based on just getting it to look like what's in the description in a text editor. I see it getting the utf-8 byte length now, but is the output writer guaranteed to be outputting in utf-8? sorry if it's a naive question, I do see the content-type is text/plain; charset=utf-8 - does that change the output writer's encoding? if it IS guaranteed, then maybe its how the character data is added - i.e. the add xml was interpreted utf-8 but the data was actually windows-1252 or similar. was (Author: djimenez): the character sequence specified seems to be windows 1251 - based on just getting it to look like what's in the description in a text editor. I see it getting the utf-8 byte length now, but is the output writer guaranteed to be outputting in utf-8? sorry if it's a naive question, I do see the content-type is text/plain; charset=utf-8 - does that change the output writer's encoding? if it IS guaranteed, then maybe its how the character data is added - i.e. the add xml was interpreted utf-8 but the data was actually windows-1251 or similar. phps (serialized PHP) writer produces invalid output -- Key: SOLR-1091 URL: https://issues.apache.org/jira/browse/SOLR-1091 Project: Solr Issue Type: Bug Components: search Affects Versions: 1.3 Environment: Sun JRE 1.6.0 on Centos 5 Reporter: frank farmer Priority: Minor Fix For: 1.4 The serialized PHP output writer can outputs invalid string lengths for certain (unusual) input values. Specifically, I had a document containing the following 6 byte character sequence: \xED\xAF\x80\xED\xB1\xB8 I was able to create a document in the index containing this value without issue; however, when fetching the document back out using the serialized PHP writer, it returns a string like the following: s:4:􀁸; Note that the string length specified is 4, while the string is actually 6 bytes long. When using PHP's native serialize() function, it correctly sets the length to 6: # php -r 'var_dump(serialize(\xED\xAF\x80\xED\xB1\xB8));' string(13) s:6:􀁸; The wt=php writer, which produces output to be parsed with eval(), doesn't have any trouble with this string. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-1071) spellcheck.extendedResults returns an invalid JSON response when count 1
[ https://issues.apache.org/jira/browse/SOLR-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12694727#action_12694727 ] Donovan Jimenez commented on SOLR-1071: --- Some other response writers, like Serialized PHP for example, always output an object or keyed array for named lists. Do they need to implement similar parameters as the JSON writer? Or, like the direction you seem to be going here, should all response structures avoid the use of named lists with repeating element names? This seems, at least to me, like a more general issue of convention and guidelines in the search components. spellcheck.extendedResults returns an invalid JSON response when count 1 -- Key: SOLR-1071 URL: https://issues.apache.org/jira/browse/SOLR-1071 Project: Solr Issue Type: Bug Components: spellchecker Affects Versions: 1.3 Reporter: Uri Boness Assignee: Grant Ingersoll Fix For: 1.3.1 Attachments: SpellCheckComponent_fix.patch, SpellCheckComponent_new_structure.patch When: wt=json spellcheck.extendedResults=true spellcheck.count 1, the suggestions are returned in the following format: suggestions:[ amsterdm,{ numFound:5, startOffset:0, endOffset:8, origFreq:0, suggestion:{ frequency:8498, word:amsterdam}, suggestion:{ frequency:1, word:amsterd}, suggestion:{ frequency:8, word:amsterdams}, suggestion:{ frequency:1, word:amstedam}, suggestion:{ frequency:22, word:amsterdamse}}, beak,{ numFound:5, startOffset:9, endOffset:13, origFreq:0, suggestion:{ frequency:379, word:beek}, suggestion:{ frequency:26, word:beau}, suggestion:{ frequency:26, word:baak}, suggestion:{ frequency:15, word:teak}, suggestion:{ frequency:11, word:beuk}}, correctlySpelled,false, collation,amsterdam beek]}} This is an invalid json as each term is associated with a JSON object which holds multiple suggestion attributes. When working with a JSON library only the last suggestion attribute is picked up. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-1071) spellcheck.extendedResults returns an invalid JSON response when count 1
[ https://issues.apache.org/jira/browse/SOLR-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12694199#action_12694199 ] Donovan Jimenez commented on SOLR-1071: --- the JSON response writer has a specific parameter for this case: json.nl It allows the the user to specify how they want named lists (which don't necessarily have unique keys suited to a JSON object map) to be treated. The values are listed in the wiki documentation: http://wiki.apache.org/solr/SolJSON I believe it affects the treatment of all named lists in the response, so if you're using facets or the like, they'd also be affected. spellcheck.extendedResults returns an invalid JSON response when count 1 -- Key: SOLR-1071 URL: https://issues.apache.org/jira/browse/SOLR-1071 Project: Solr Issue Type: Bug Components: spellchecker Affects Versions: 1.3 Reporter: Uri Boness Assignee: Grant Ingersoll Fix For: 1.3.1 When: wt=json spellcheck.extendedResults=true spellcheck.count 1, the suggestions are returned in the following format: suggestions:[ amsterdm,{ numFound:5, startOffset:0, endOffset:8, origFreq:0, suggestion:{ frequency:8498, word:amsterdam}, suggestion:{ frequency:1, word:amsterd}, suggestion:{ frequency:8, word:amsterdams}, suggestion:{ frequency:1, word:amstedam}, suggestion:{ frequency:22, word:amsterdamse}}, beak,{ numFound:5, startOffset:9, endOffset:13, origFreq:0, suggestion:{ frequency:379, word:beek}, suggestion:{ frequency:26, word:beau}, suggestion:{ frequency:26, word:baak}, suggestion:{ frequency:15, word:teak}, suggestion:{ frequency:11, word:beuk}}, correctlySpelled,false, collation,amsterdam beek]}} This is an invalid json as each term is associated with a JSON object which holds multiple suggestion attributes. When working with a JSON library only the last suggestion attribute is picked up. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez resolved SOLR-341. -- Resolution: Invalid Now that the Solr integration in PHP wiki page is updated to reflect the new download location for the client this issue no longer needs to stay open. PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Description: Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). was: Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? updated issue text to reflect new file hosting on Google Code. PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Attachments: SolrPhpClient.2008-09-02.zip, SolrPhpClient.2008-11-14.zip, SolrPhpClient.2008-11-25.zip, SolrPhpClient.zip Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.2008-09-02.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Attachments: SolrPhpClient.2008-11-14.zip Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Attachments: SolrPhpClient.2008-11-14.zip Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.2008-11-25.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Attachments: SolrPhpClient.2008-11-14.zip Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.2008-11-14.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.5 Since I'm unable to currently update the Solr WIKI page that points to this issue and its downloads, I've left this issue open. I, however, need to note that active releases of the PHP code are now available from: http://code.google.com/p/solr-php-client/downloads/list If you have any issues specific to this PHP client, please post / discuss them there (or on the solr user mailing list - I am a subscriber). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.2008-11-24.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.4 Attachments: SolrPhpClient.2008-09-02.zip, SolrPhpClient.2008-11-14.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.2008-11-25.zip You are correct, I didn't zip up the updated files. I did the work on a branch, but my build script takes from trunk. This new one should be what you want - i double checked :P, sorry for the confusion. PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.4 Attachments: SolrPhpClient.2008-09-02.zip, SolrPhpClient.2008-11-14.zip, SolrPhpClient.2008-11-25.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.2008-11-24.zip Added additional functionality to Apache_Solr_Document and Apache_Solr_Service for document and field based boost values. {noformat} $doc = new Apache_Solr_Document(); // can set document boost $doc-setBoost(1.5); // can set a field boost at value assignment time $doc-setField('foo', 'bar', 1.3); // or as a separate call $doc-setFieldBoost('foo', 3.141579); {noformat} PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.4 Attachments: SolrPhpClient.2008-09-02.zip, SolrPhpClient.2008-11-14.zip, SolrPhpClient.2008-11-24.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-856) Suport for Accept-Encoding : gzip in SolrDispatchFilter
[ https://issues.apache.org/jira/browse/SOLR-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12647612#action_12647612 ] Donovan Jimenez commented on SOLR-856: -- Isn't this usually handled as a configuration of the Container rather than at the servlet level? For example, in Tomcat, I'd use the compression option on the HTTP connector described in the documentation: http://tomcat.apache.org/tomcat-6.0-doc/config/http.html I'm sure other containers have similar, already existing, functionality. Suport for Accept-Encoding : gzip in SolrDispatchFilter - Key: SOLR-856 URL: https://issues.apache.org/jira/browse/SOLR-856 Project: Solr Issue Type: Improvement Reporter: Noble Paul Attachments: SOLR-856.patch If the client sends an Accept-Encoding : gzip header then SolrDispatchFilter should respect that and send back data as zipped -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.2008-11-14.zip Rich Robinson helped me to track down an issue where he found that documents with values = false were creating prematurely exiting foreach loops (when iterating a document). I determined it was the valid() implementation of the Iterator iterface, and after fussing with it decided to just implement IteratorAggregator instead and use the pre-existing SPL ArrayIterator class. This simplifies the Apache_Solr_Document code and now all document values are looped even when some are false. PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Fix For: 1.4 Attachments: SolrPhpClient.2008-09-02.zip, SolrPhpClient.2008-11-14.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-848) The search method cannot manager several values for a single parameter
[ https://issues.apache.org/jira/browse/SOLR-848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12646624#action_12646624 ] Donovan Jimenez commented on SOLR-848: -- Antoine, Yes, the params argument is an associative array - I felt this was the simplest way to support all the possible arguments that different output writers and searchers can take. This doesn't exclude you from passing multiple values for the same parameter, as in your case. I use http_build_query() but then reformat the query string into what Solr expects. Just pass all repeat parameters as arrays of value, Solr will parse each set of related values in order (ie. facet.field and facet.query). - Donovan The search method cannot manager several values for a single parameter -- Key: SOLR-848 URL: https://issues.apache.org/jira/browse/SOLR-848 Project: Solr Issue Type: Improvement Components: clients - php Environment: Any Reporter: Antoine Tissier Original Estimate: 4h Remaining Estimate: 4h If you look at this wiki page : http://wiki.apache.org/solr/SimpleFacetParameters You will notice the url may looks like : http://localhost:8983/solr/select?q=videorows=0facet=truefacet.field=inStockfacet.query=price:[*+TO+500]facet.query=price:[500+TO+*] Two values for the field facet.query. It can also happen you have several values for the variable facet.field. Unfortunately, here is the current Apache_Solr_Service::search method public function search($query, $offset = 0, $limit = 10, $params = array()) { (...) $queryString = http_build_query($params, null, $this-_queryStringDelimiter); (...) } $params is an associative array. In my opinion, (tell me if i am wrong), but this way you cannot generate this kind of query. Regards Antoine Tissier -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: ClientUtils escape query
In the PHP client I used these: pre /** * Escape a value for special query characters such as ':', '(', ')', '*', '?', etc. * * NOTE: inside a phrase fewer characters need escaped, use [EMAIL PROTECTED] Apache_Solr_Service::escapePhrase()} instead * * @param string $value * @return string */ static public function escape($value) { //list taken from http://lucene.apache.org/java/docs/ queryparsersyntax.html#Escaping%20Special%20Characters $pattern = '/(\+|-||\|\||!|\(|\)|\{|}|\[|]|\^||~|\*|\?|:|\\\)/'; $replace = '\\\$1'; return preg_replace($pattern, $replace, $value); } /** * Escape a value meant to be contained in a phrase for special query characters * * @param string $value * @return string */ static public function escapePhrase($value) { $pattern = '/(|\\\)/'; $replace = '\\\$1'; return preg_replace($pattern, $replace, $value); } /pre helpful? On Aug 5, 2008, at 4:16 PM, Ryan McKinley wrote: That came after I spent a week increasing the list of things that need escaped one at a time (waiting for errors along the way...) Erik suggested I look at how the ruby client handles it... and I haven't seen any problem since them. Is there any problem with over escaping? I know it makes some things look funny. Perhaps there is a regex that will do any non- letter except ryan On Aug 5, 2008, at 8:28 AM, Grant Ingersoll wrote: ClientUtils.escapeQueryChars seems a bit aggressive to me in terms of what it escapes. It references http://lucene.apache.org/java/ docs/queryparsersyntax.html#Escaping Special Characters, but doesn't explicitly escape them, instead opting for the more general \W regex. Thus, I'm noticing that chars that don't need to be escaped ( like / ) are being escaped. Anyone recall why this is? I suppose the problem comes in when one considers other query parsers, but maybe we should just mark this one as explicitly for use w/ the Lucene QP? -Grant
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.zip Updates to PHP client * fixes Apache_Solr_Document::setMultiValue typo * Apache_Solr_Service_Balancer fixes * Apache_Solr_Service / Apache_Solr_Response now use the json.nl parameter for NamedList handling at the Solr server side instead of doing PHP client side * Apache_Solr_Service::commit() method signature has changed for optimize parameter * Included a Changelog file generated from subversion PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [jira] Updated: (SOLR-341) PHP Solr Client
As noted in the comments, you need one of the following: - PHP version = 5.2 (includes the json_decode function by default) - The JSON module installed through PECL (still requires PHP 5 but can work with lesser versions) - a defined json_decode function alternative, for example, the Zend framework has a Zend_Json class with a decode function. You could replace the json_decode call with a call to this class, or you could take it as an example for defining your own. I'm sure PEAR has some JSON decoding libraries as well. the client will probably not work without PHP 5 and definitely will not work with the json_decode function as you've found out - Donovan Jimenez On Oct 4, 2007, at 12:35 AM, Yosvanys Aponte Báez wrote: I have this error with your example search returned with status = Fatal error: Call to undefined function json_decode() in C:\AppServ \www\SolrPhpClient1\Apache\Solr\Response.php on line 195 Can you help me -Mensaje original- De: Donovan Jimenez (JIRA) [mailto:[EMAIL PROTECTED] Enviado el: martes, 02 de octubre de 2007 19:14 Para: solr-dev@lucene.apache.org Asunto: [jira] Updated: (SOLR-341) PHP Solr Client [ https://issues.apache.org/jira/browse/SOLR-341? page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.zip Updates to the Solr Client: - search can now take muliple parameters of the same name, such as when using facets - ping now can take a timeout value which acts as a maximum time allowed to wait for a response - namespace change to Apache_Solr to avoid confusion with php Solar (unrelated) project - Apache_Solr_Document now implements iterator interface, so its fields can be foreach'd - Reference implementation of a read from slave / write to master balancer has be added PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service ('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response- responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. Universidad 2008 Del 11 al 15 de febrero del 2008 Palacio de Convenciones. La Habana. Cuba. Sitio Web: http://www.universidad2008.cu
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.zip Updates to the Solr Client: - search can now take muliple parameters of the same name, such as when using facets - ping now can take a timeout value which acts as a maximum time allowed to wait for a response - namespace change to Apache_Solr to avoid confusion with php Solar (unrelated) project - Apache_Solr_Document now implements iterator interface, so its fields can be foreach'd - Reference implementation of a read from slave / write to master balancer has be added PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip, SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: (was: SolrPhpClient.zip) PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (SOLR-341) PHP Solr Client
PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SOLR-341) PHP Solr Client
[ https://issues.apache.org/jira/browse/SOLR-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donovan Jimenez updated SOLR-341: - Attachment: SolrPhpClient.zip Attaching a new zip because previous had bug in Solr_Service::escape function PHP Solr Client --- Key: SOLR-341 URL: https://issues.apache.org/jira/browse/SOLR-341 Project: Solr Issue Type: New Feature Components: clients - php Affects Versions: 1.2 Environment: PHP = 5.2.0 (or older with JSON PECL extension or other json_decode function implementation). Solr = 1.2 Reporter: Donovan Jimenez Priority: Trivial Attachments: SolrPhpClient.zip Developed this client when the example PHP source didn't meet our needs. The company I work for agreed to release it under the terms of the Apache License. This version is slightly different from what I originally linked to on the dev mailing list. I've incorporated feedback from Yonik and hossman to simplify the client and only accept one response format (JSON currently). When Solr 1.3 is released the client can be updated to use the PHP or Serialized PHP response writer. example usage from my original mailing list post: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response-responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually, most of this is done by json_decode ) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: PHP Solr Client source
In regards to 1.3 PHP based response writers: I did see this and included two response interpreters for these in my source (though I wasn't developing against Solr 1.3 so they are more stubs than useable). The Solr_Response follows a factory pattern and automatically chooses the correct Response subclass based on the Content-Type of the HTTP response header. Each subclass then tries to provide the same method of access to the different parts of the response. Both JSON and XML are fully implemented (I found interpretting JSON search responses was fastest for search responses - not to mention the slightly smaller data size) The license: I chose the new BSD license because it is the Zend Framework's license. The Apache 2.0 license seems very similar with the exception of how the license and attributions are included. I've changed the license and included the LICENSE and NOTICE files with my source. I just followed the directions at http://www.apache.org/licenses/LICENSE-2.0.html#apply Will I or the company need to sign a CLA now as well? The code: I attached my source to my email not knowing whether it would come through or not (it was only 7k in a tarball so I thought it was worth a shot). Since it didn't, I'll provide a link below. Also this gives me a change to include PHPdoc files as well which should be a good reference for understanding what I did. link to files (zip): http://www.conduit-it.com/Solr/ - Donovan Jimenez On Aug 16, 2007, at 10:17 PM, Pieter Berkel wrote: Hi Donovan, This sounds very promising, I've also recently been working on a php solr client library for use within my organization but the code is not well documented nor licensed appropriately just yet. You may note that eval()-able and serialized php response writers were recently added to svn trunk (see http://issues.apache.org/jira/browse/SOLR-196 ) so it may be more efficient to use these rather than converting XML / JSON formatted data. In terms of licensing, I'm not sure if the new BSD license is compatible with the Apache 2.0 license (see: http://www.apache.org/licenses/LICENSE-2.0) that Solr is released under, this would only be an issue if your php client was to be included in the Solr distribution (which would be useful but not manditory). I'd be interested to take a look at your client library code, are you planning to release it soon? regards, Piete On 17/08/07, Donovan Jimenez [EMAIL PROTECTED] wrote: The company I work for recently started using Solr for some of our search functionality. After downloading the files for integrating with PHP that the Wiki links to I saw that it wasn't usable for our purposes. So, as part of the project, I developed a PHP Solr Client. Coming back to the mailing list I see that there was recent talk about developing a new PHP client, but as of yet I haven't seen it posted - so I hope I'm not stepping on any toes. I received permission from my company to release the code to the community under the new BSD license. The coding style is approximately inline with the Zend Framework's standards (and somewhat PEAR's) and I feel it's well documented. Client Requirements: - PHP 5 = 5.2.0 (we developed on 5.2.1) that has the json_decode function (available by default as of 5.2) and the XmlReader class (enabled by default as of 5.1) - allow_url_fopen php.ini setting must be enabled (defaults to enabled) We'd love to have the community help us maintain this as Solr evolves. Let us know what you think. Thanks. - Donovan Jimenez For those interested: The starting point is the Solr_Service class. From this class you have access to all the major functionality of the Solr HTTP service (add, delete by id, delete by query, commit, optimize and search). Below I've include a sample of the client's API for searching: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service ('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response- responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually most of this is done by json_decode if the response is //in json format - done by an XmlReader loop if its XML) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure
Re: PHP Solr Client source
Understood, but do ALL Solr service calls allow you to specify the format? I thought the wt parameter was a select / search only feature, which is why I implemented xml (to deal with anything I couldn't specify) AND json (because this was the fastest to parse from 1.2 on search). Every function of the client except for ping returns a Solr_Response object. Typically you might not read anything from this response when its not a search operation, but you could if you wanted. If all calls can have the response format specified then I'm all for simplification. Especially if serialized or eval'able PHP responses are faster or as fast as decoding JSON. Not only would it simply the client but it would also relax the PHP version requirements (json_decode and XmlReader are the driving factors). - Donovan On Aug 18, 2007, at 10:06 PM, Yonik Seeley wrote: On 8/17/07, Donovan Jimenez [EMAIL PROTECTED] wrote: In regards to 1.3 PHP based response writers: I did see this and included two response interpreters for these in my source (though I wasn't developing against Solr 1.3 so they are more stubs than useable). The Solr_Response follows a factory pattern and automatically chooses the correct Response subclass based on the Content-Type of the HTTP response header. Each subclass then tries to provide the same method of access to the different parts of the response. Both JSON and XML are fully implemented (I found interpretting JSON search responses was fastest for search responses - not to mention the slightly smaller data size) Solr has multiple response formats so the client can pick the most convenient. There's increased maintenance associated with accepting multiple on the client side. -Yonik
PHP Solr Client source
The company I work for recently started using Solr for some of our search functionality. After downloading the files for integrating with PHP that the Wiki links to I saw that it wasn't usable for our purposes. So, as part of the project, I developed a PHP Solr Client. Coming back to the mailing list I see that there was recent talk about developing a new PHP client, but as of yet I haven't seen it posted - so I hope I'm not stepping on any toes. I received permission from my company to release the code to the community under the new BSD license. The coding style is approximately inline with the Zend Framework's standards (and somewhat PEAR's) and I feel it's well documented. Client Requirements: - PHP 5 = 5.2.0 (we developed on 5.2.1) that has the json_decode function (available by default as of 5.2) and the XmlReader class (enabled by default as of 5.1) - allow_url_fopen php.ini setting must be enabled (defaults to enabled) We'd love to have the community help us maintain this as Solr evolves. Let us know what you think. Thanks. - Donovan Jimenez For those interested: The starting point is the Solr_Service class. From this class you have access to all the major functionality of the Solr HTTP service (add, delete by id, delete by query, commit, optimize and search). Below I've include a sample of the client's API for searching: ?php require_once('Solr/Service.php'); $start = microtime(true); $solr = new Solr_Service(); //Or explicitly new Solr_Service ('localhost', 8180, '/solr'); try { $response = $solr-search('solr', 0, 10, array(/* you can include other parameters here */)); echo 'search returned with status = ', $response- responseHeader-status, ' and took ', microtime(true) - $start, ' seconds', \n; //here's how you would access results //Notice that I've mapped the values by name into a tree of stdClass objects //and arrays (actually most of this is done by json_decode if the response is //in json format - done by an XmlReader loop if its XML) if ($response-response-numFound 0) { $doc_number = $response-response-start; foreach ($response-response-docs as $doc) { $doc_number++; echo $doc_number, ': ', $doc-text, \n; } } //for the purposes of seeing the available structure of the response //NOTE: Solr_Response::_parsedData is lazy loaded, so a print_r on the response before //any values are accessed may result in different behavior (in case //anyone has some troubles debugging) //print_r($response); } catch (Exception $e) { echo $e-getMessage(), \n; } ?