For some reason the default behavior in the PHP library is to collapse arrays in the response with one value into a scalar. This seems wrong to me - if you know something is a multi-value you'd always want an array to iterate over even if a document just has one value for that field. I'm surprised we have not seen more problems - but I guess we are usually requesting single-value items in the response (e.g. uid, nid, path, etc).
I suggest we alter the factory function (or the overriding class?) to make this not collapse by default.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | do-not-collapse-668662-1.patch | 1.05 KB | pwolanin |
Comments
Comment #1
pwolanin commentedComment #2
jpmckinney commentedSeems reasonable to me. Anyone expecting the field to collapse to a value (the old behaviour) must also be expecting the field to occasionally be an array. Fixed in 2.x http://drupal.org/cvs?commit=359244
Comment #3
pwolanin commentedDid you commit to all branches?
Comment #4
jpmckinney commentedComment #5
pwolanin commentedlooks like this no longer applies to 1.x - apparently the branches are out of sync in that function?
Comment #6
jpmckinney commentedYes, looking into it. #554690: Better exception handling strategy may be related.
Comment #7
jpmckinney commentedHere's the commit that introduced the try-catch. http://drupalcode.org/viewvc/drupal/contributions/modules/apachesolr/apa...
Commit message for 2.x was "#3361182 fix path, additional API cleanup". Issue number is actually #336118: overhaul of APIs, fix Luke. I see no mention of adding a try-catch in that issue, but that is nonetheless the issue to which the commit refers.
The commit that removed the try-catch in 1.x comes out of #742998: calling deleteByQuery causes error: "Call to a member function deleteByQuery() on a non-object".
Comment #8
jpmckinney commentedCommitted to 6.x-1.x http://drupal.org/cvs?commit=360000.
Needs port to 5.x-2.x after #742998: calling deleteByQuery causes error: "Call to a member function deleteByQuery() on a non-object" is ported to 5.x-2.x.
Comment #9
jpmckinney commentedFixed in 5-2. http://drupal.org/cvs?commit=360696