I noticed this code in the apachesolar.module file:
// Chunk the adds by 20s
$docs_chunk = array_chunk($documents, 20);
foreach ($docs_chunk as $docs) {
$solr->addDocuments($docs);
}
$solr->addDocuments($documents);
I think this adds all the documents twice as $documents does not get truncated after a call to array_chunk. At least, when I add a call to count the items in $documents it has the same number it did before. The description here (http://us.php.net/array_chunk) makes it seem like the last element should have up to the chunk size for arrays that have remainders.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | apachesolr.module.patch | 375 bytes | hurleyit |
Comments
Comment #1
pwolanin commentedpossibly this is fixed in 5.x-dev? If not, hopefully Robert will get it. Looks fixed in 6.x:
Comment #2
hurleyit commentedI just looked at the latest development snapshot and it seems to still be there. PHP is not my strength, I mostly program in Perl, but I am learning. This is definitely a problem though? I can try to create a patch if it is.
Comment #3
pwolanin commentedYes, seems like a problem indeed
Comment #4
hurleyit commentedI think I did the patch correctly. Please let me know if there are any issues as this is my first patch.
Comment #5
pwolanin commentedlooks fine - committed to the 5.x branch. Thanks.