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)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bgilhome created an issue. See original summary.

bgilhome’s picture

bgilhome’s picture

I'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).

loparr’s picture

Hi 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.

pianomansam’s picture

These updates seem to be working for me!

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Me too, thank you!

deekayen’s picture

Status: Reviewed & tested by the community » Fixed

  • deekayen committed 09f1373 on 7.x-2.x authored by bgilhome
    Issue #2561577 by bgilhome, pianomansam, jenlampton: Various fixes
    
deekayen’s picture

Don't mix Benadryl with code commit credits or you'll mess up like that.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.