Proposed solution (from http://www.drupal.ru/node/76600#comment-486657):

--- /sites/all/modules/similar/views/similar_handler_argument_nid.inc
+++ /sites/all/modules/similar/views/similar_handler_argument_nid.inc
@@ -268,17 +268,20 @@
     // and populate the $text variable with node titles and bodies.
     foreach ($this->value as $nid) {
       $node = node_load($nid);
-      if (isset($node->title) && isset($node->body) && isset($node->body[$node->language])) {
+      if (isset($node->title) && isset($node->body) && (isset($node->body[$node->language]) || isset($node->body['und']))) {
         // Remove punctuation from the title.
-        $title = preg_replace('/[^a-z0-9 _-]+/i', '', $node->title);
+        $title = preg_replace('/[^a-z0-9а-я _-]+/iu', '', $node->title);
 
         // Alter the relevancy of words in the node title if option is selected.
         if ($boolean && !empty($this->options['source_relevance']) && isset($this->options['title_operator'])) {
           $title = $this->alter_node_title($title);
         }
 
         // Strip tags and add slashes only to the body before adding the title.
-        $body = trim(addslashes(strip_tags($node->body[$node->language][0]['value'])));
+        if(isset($node->body[$node->language]))
+          $body = trim(addslashes(strip_tags($node->body[$node->language][0]['value'])));
+        else
+          $body = trim(addslashes(strip_tags($node->body['und'][0]['value'])));
         $text .= " $title $body";
       }
     }

Comments

cuman’s picture

а-я - letters of the Russian (Cyrillic) alphabet

Marko B’s picture

I have similar problem, croatian letters like "čžđšđ" doesn't work, probably the same reason. When I have node with only english alphabet it works, for non-english it doesnt find similar titles.

Marko B’s picture

I solved it with this for title. Body guess this code above from cuman can be used.

$title = preg_replace('/[^a-z0-9 _-čćšđžČĆŽŠĐ]+/iu', '', $node->title);

Anonymous’s picture

We seem to have worked on the same thing. See #1958136: Fails to calculate score - perhaps an i18n issue. Please be aware there is another bug in this place: title and body should be taken into account separately. Your current solution seems to fail in case the body is empty.

kedramon’s picture

StatusFileSize
new6.49 KB

Hi guys,

have same problems with Cyrillic alphabet, here is my patch,
it is also fix missing body field bug,
and I hope it fix all language.

dillix’s picture

Version: 7.x-2.0-beta5 » 7.x-2.x-dev
kedramon’s picture

Las update of this module is December 2, 2014, can we expect some update?

jenlampton’s picture

Status: Patch (to be ported) » Needs work

It looks like the status wasn't set to "Needs Review" so that is likely why this patch hasn't been reviewed yet for inclusion. Please update the status when a patch is uploaded, if possible.

This patch will need to be updated to remove the fix for the other issue. That issue should have it's own patch in it's queue, and applying them both to the project will cause problems. In general keeping things separate will keep progress moving along faster as a problem with one patch won't prevent the other from being merged.

kedramon’s picture

Status: Needs work » Needs review
StatusFileSize
new9.7 KB

After 2 year ago!
Here is the patch with some codestyle fixes.

pashikk’s picture

After 2 year ago!
Here is the patch with some codestyle fixes.

For what version is this patch? I got 7.x-2.x-dev of 2016-Dec-24 and the patch fails to appy.

dillix’s picture

Status: Needs review » Needs work

This patch is for beta5. It doesn't work with beta6 & latest dev.