Any mutlivalue fields returned from solr is appended together both within each node and between nodes. For example, the taxonomy fields ended up appending and the lists gets longer and longer. To duplicate this, you must have taxonomy or some other multivalue fields solr is searching. The nodes you are searching must also have these multi-values, preferably different, in order to see it happening.
I am attaching 2 files, response.txt showing that solr is returning correctly, and print_r.txt is a simple print_r($response->documents) in the file apachesolr_search.module after line 80. I can't figure out how the response gets updated but if you put it in before line 80, you see the original result from solr, but after line 80, you see the Apache_Solr_Document array.
Notice that in the file examples, I have created an additional mutlivalue field of contributor names but taking this out has no effect on the outcome so this problem isn't related to it.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | results_documents.txt | 5.38 KB | pahariwalla |
| response.txt | 12.75 KB | kleung11 | |
| printr.txt | 20.17 KB | kleung11 |
Comments
Comment #1
robertdouglass commentedThis needs to be validated and possibly fixed for 1.0 release.
Comment #2
janusman commentedI think this is a duplicate of http://drupal.org/node/274833
Comment #3
kleung11 commentedActually, this doesn't seem to be the same issue but they are similar. The problem with the other issue is on the request having repeated tids. However, this one is about the response being correct from solr but then the apachesolr module appends everything together as one. This isn't related specifically to tids as it is for all multivalue items are appended together, and worse, even between nodes!
Comment #4
pahariwalla commentedSorry I can't quite understand the error. Could you please give a specific instructions to re-create the problem. i.e. the simplest situation where the problem occurs? Thanks.
Comment #5
kleung11 commentedThe simplest case is to have taxonomy enabled, then have a bunch of taxonomies added to node1, node2, and node3, preferably different ones for each. Then search for a term that would return all 3 nodes in search results. If you do a print_r($response->documents) in the fileapachesolr_search.module after line 80 (note, line number is for alpha3 and is probably diff for 5.x dev branch), you will see that the multivalue arrays is appended as indicated in my sample file across nodes. This almost seem like it's a problem with solr, however, if you do a solr search directly from solr/admin, you will see that the result is fine.
An example might be...
nid, title, tax terms
1,books for geeks, "electronics, gadgets"
2, language books, "english, spanish, chinese"
3, computer books, "computers, programming"
search for books, all three nodes are returned. Then check out tids returned, the first node result will have tids for electronics and gadgets. The second node result will have results of electronics, gadgets, english, spanish, chinese. The third will have electronics, gadgets, english, spanish, chinese, computers, programming.
I am using taxnomies as an example, but all multivalue arrays are in fact appended if you have them indexed as well and put into the same array.
Thanks for looking!
Comment #6
pahariwalla commentedI can't reproduce the error. Am I missing something? Is there some circular referencing going on with your data? hmmm...
Here's what I did - using clean cvs up (// $Id: apachesolr_search.module,v 1.1.2.16 2008/09/17 08:07:28 robertDouglass Exp $
1) made a new content type called "book"
2) made a new vocabulary called "booktype", applicable to content type "book"
3) created 3 books and entered taxonomies as per your example
4) searched on "book"
5) the $response->documents object has 3 elements, and each has the proper entries under [taxonomy_name] and [tid].
attached is the output using:
dpr($response->documents)after line:
$response = $solr->search($query->get_query(), $params['start'], $params['rows'], $params);in function apachesolr_search_search of module apachesolr_search.module
Comment #7
janusman commented@kleung11: I think this was fixed from the alpha3 version, try the DEV version like pahariwalla suggests.
Comment #8
pahariwalla commentedIs this a dead issue ?
@kleung11 FYI - If you need to work with alpha3, I believe that the function which creates the Apache_Solr_Document Object is
private function _parseData()in module /apachesolr/SolrPhpClient/Apache/Solr/Response.php
Comment #9
kleung11 commentedok, I will test this out again today. Thanks for the update.
Comment #10
kleung11 commented@pahariwalla You are correct, it is fixed in dev version. This is a problem on the alpha3 version only. I made the change to Response.php and it worked just like you said. Great job!
Comment #11
kleung11 commentedComment #12
pahariwalla commentedYippie! and Thanks! I have to admit, it took a little time to figure it out, but I learned a good deal. I've a much better understanding of SolrClient and the XML schema, but probably the most important thing I learned was at the end of the trip.... I should check the Version before I dive into an Issue! :-0