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.
I've attached a patch for various fixes including:
- Support text_long fields in similar_index_fields()
- Still call _similar_save_index() even if index already exists (just skip creating the index) so that the index is saved to the variable SIMILAR_INDICES
- Use variable_get in _similar_save_index instead of similar_get_indices() (just uses the static variable which means only one will be added after calling similar_reset_indices())
- Add title and body to $text separately in similar_handler_argument_nid->query in case one is empty
- Use if ($weight) instead of if ($weight !== 0) in similar_handler_argument_nid->similar_build_query since it may be a string
- Check $alias is not NULL in similar_handler_argument_nid->similar_build_query (eg. trying to add a table from a field not attached to the entity)
Comment | File | Size | Author |
---|---|---|---|
#3 | similar-various_fixes-2561577-3.patch | 4.96 KB | bgilhome |
#2 | similar-various_fixes-2561577-1.patch | 4.61 KB | bgilhome |
Comments
Comment #2
bgilhome CreditAttribution: bgilhome commentedComment #3
bgilhome CreditAttribution: bgilhome commentedI've updated this patch to include getting field aliases using relationships if applicable in similar_build_query (from https://www.drupal.org/node/1263868#comment-10326127).
Comment #4
loparr CreditAttribution: loparr commentedHi thank you for patch. Would it be possible to use it to add more contextual filters to views? Currently, it is not possible. Adding another contextual filter causes no results.
Comment #5
pianomansam CreditAttribution: pianomansam commentedThese updates seem to be working for me!
Comment #6
jenlamptonMe too, thank you!
Comment #8
deekayen CreditAttribution: deekayen as a volunteer commentedComment #10
deekayen CreditAttribution: deekayen as a volunteer commentedDon't mix Benadryl with code commit credits or you'll mess up like that.