Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When indexing content, the apache solr teaser is created using the node teaser (if exists).
Right now, the Apache Solr Search assumes that the body field have a language and by default the field language is the node language. As far as I know, the only module that makes use of field language is Entity Translation so I created a patch to check if this is an active module and use a field with a language, otherwise LANGUAGE_NONE must be used as this is the default way of work.
Please comment.
Cheers
Comment | File | Size | Author |
---|---|---|---|
#10 | apachesolr-indexing_teaser-2315173-10.patch | 917 bytes | stefan.r |
#4 | apachesolr-indexing_teaser-2315173-4.patch | 913 bytes | stefan.r |
#3 | apachesolr-indexing_teaser-2315173-2.patch | 1.18 KB | rutiolma |
Comments
Comment #1
rutiolmaThe patch
Comment #3
rutiolmaComment #4
stefan.r CreditAttribution: stefan.r commented@rmarques, Bart D asked me to have a look at this and a patch like this would indeed be needed in case the body field language doesn't match the node language.
Does the attached patch work for you too? It gets the body field language directly, instead of "guessing" what it is ;)
Comment #5
stefan.r CreditAttribution: stefan.r commentedFor reference:
http://drupal.stackexchange.com/questions/8404/what-is-right-way-to-modi...
https://www.drupal.org/node/1388922#comment-5464106
Comment #8
Nick_vhLooks good to me. So this makes sure that we get the teaser in the default language of the body field? And this only happens when there is no active node teaser. Is there a similar issue with the node teaser if it does exist?
Comment #9
stefan.r CreditAttribution: stefan.r commentedThanks @Nick_vh.
That comment about "no active node teaser" was added in #2012244: In Drupal 7, using short summary in the teaser, I think it refers to
$node->teaser
not existing but that property never exists in Drupal 7 anyway. Or maybe it refers to theutf8_truncate()
a few lines down (which is beyond the scope of this patch).As to any similar issues, there's the links in comment #5 of this issue, comment #9 in #1178580: PHP notices with [node:summary], [node:body], or [comment:body] if there is no body field or language mismatch and the patch in #1241334: Auto settings for Metatags Quick.
Comment #10
stefan.r CreditAttribution: stefan.r commentedWhile we're changing this anyway, merging in #2297243: Teaser is empty when indexing translated content seems appropriate, as well as using a clearer variable name as per #1216094: We call too many things 'language', clean that up :)
Comment #11
rutiolmaThank you for your input Stefan, your patch work like a charm.
Comment #12
Nick_vhok, good to go
Comment #13
stefan.r CreditAttribution: stefan.r commentedcan we get this committed? :)
Comment #14
japerry