When the option "Limit search to user's language by default" is enabledon Apache Solr Multilingual config screen, results highlighting doesn't work and is always empty.

When the option is enabled, the hl.fl parameter (ie. $params['hl.fl']) for the query is modified to body_$filter_language by apachesolr_multilingual_apachesolr_modify_query() invoked from apachesolr_do_query() and itself invoked from apachesolr_search_execute(). The $param parameter of apachesolr_do_query() is passed by value and is not returned (unlike the query passed in the $current_query parameter). So when the response is processed by apachesolr_process_response() (invoked from apachesolr_search_execute()), $params['hl.fl'] is used to retrieve the highlighting but it hasn't been altered. Thus highlighting in the response is not seen because of the mismatch between the field name used in the response and the value of $params['hl.fl'].

Comments

mkalkbrenner’s picture

Status: Active » Closed (duplicate)

Please read the release notes of 6.x-1.0-beta3 at http://drupal.org/node/900642
It's not our fault.

If you filter search results by language you won't see text snippets as long as issue #899560: apachesolr_do_query() has to take &$params by reference is not fixed for Apache Solr Search Integration 6.x-1.x.

This patch has been committed to CVS but unfortunately it has not been released yet. But you can try the dev version of apachesolr 6.x-1.x: http://drupal.org/node/259285

wouters_f’s picture

Title: Highlighting does not work for searches limited to user's language » snippets are not highlighted in multilingual search results, dd stays empty

I was so lucky to have found where the problem was and fixed it.
Only so much later I found this post.
At least I know how the apachesolr module works from the inside out now.