Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2012 at 09:04 UTC
Updated:
30 Oct 2012 at 07:46 UTC
Jump to comment: Most recent file
Comments
Comment #1
mkalkbrennerI get the same warning. The function in Apache Solr Multilingual has been coded according to the documentation in apachesolr.api.php:
Therefor this issue gets moved to Apache Solr Search Integration.
Comment #2
nick_vhIn any case, I'd suggest you to use hook_apachesolr_index_document_build,
will look into this issue
Comment #3
mkalkbrennerhook_apachesolr_index_document_build is called to early. For the modifications done by multilingual we need the teaser and the tags to be part of the document already:
Comment #4
nick_vh"A maximum of 2 alterable arguments is supported. In case more arguments need to be passed and alterable, modules provide additional variables assigned by reference in the last $context argument"
Seems nobody has ever tested that alter hook. Most of the times the build hook is sufficient.
What are our options here?
We can give it one context argument with documents and the second one with entity, entity_type and $env_id as a key => value storage?
Comment #5
nick_vhComment #6
nick_vhSince we only need to alter the documents array (all the other values won't have any effect) the rest is considered as context and can be given to the alter as one array
Comment #8
mkalkbrennerWhy not implementing a normal hook using module_invoke_all() instead of drupal_alter()?
This way we have an absolute compatible change which is fine even for the current release candidate status.
Comment #9
nick_vhAPI changes documented
Comment #10
nick_vhHmm, the new hook would be a solution, that allows us not to change the API. Looking into it
Comment #12
nick_vhJust tested this, works as expected when you loop over the documents and change it.
Only problem that stands is that the array itself can't be altered. Somehow the pointer to that array does not seem to function. eg.: This means that if you add another document to the array, it won't reach the indexing process.
Still investigating
Comment #13
nick_vhComment #14
nick_vhThis won't work
Comment #15
pwolanin commentedcommited this which fixes whitespace. needs to be ported
Comment #16
nick_vhcommitted without modifications, worked as expected
Comment #18
ronniekoopmans commented// Not possible because you can't give the documents array as a reference
module_invoke_all('apachesolr_index_documents_alter', $documents, $entity, $entity_type, $env_id);
Objects always pass by reference, even if the array itself is a copy.
xx_apachesolr_index_documents_alter($documents, ..) works
xx_apachesolr_index_documents_alter(&$documents, ..) works, generates php notice