# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /var/www/stroka/modules/search
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: search.info
--- search.info Базовая редакция (BASE)
+++ search.info Изменен локально (на основе LOCAL)
@@ -7,6 +7,7 @@
 files[] = search.test
 configure = admin/config/search/settings
 stylesheets[all][] = search.css
+dependencies[] = rustemmer
 
 ; Information added by drupal.org packaging script on 2011-06-30
 version = "7.4"
Index: search.module
--- search.module Базовая редакция (BASE)
+++ search.module Изменен локально (на основе LOCAL)
@@ -1148,8 +1148,12 @@
   $included = array();
   $foundkeys = array();
   $length = 0;
+  $stemmer = new RussianStemmer();
   while ($length < 256 && count($workkeys)) {
     foreach ($workkeys as $k => $key) {
+      $key = $stemmer->stem_word($key);
+      $keys[$k] = $key;
+
       if (strlen($key) == 0) {
         unset($workkeys[$k]);
         unset($keys[$k]);
@@ -1167,7 +1171,8 @@
       // space). First try bare keyword, but if that doesn't work, try to find a
       // derived form from search_simplify().
       $p = 0;
-      if (preg_match('/' . $boundary . $key . $boundary . '/iu', $text, $match, PREG_OFFSET_CAPTURE, $included[$key])) {
+      if (preg_match('/'. $boundary . '[' . RUSTEMMER_CHARS . ']*' . $key . '[' . RUSTEMMER_CHARS . ']*' . $boundary .'/iu', $text, $match, PREG_OFFSET_CAPTURE, $included[$key])) {
+      //if (preg_match('/' . $boundary . $key . $boundary . '/iu', $text, $match, PREG_OFFSET_CAPTURE, $included[$key])) {
         $p = $match[0][1];
       }
       else {
@@ -1253,7 +1258,8 @@
   $keys = array_merge($keys, $foundkeys);
 
   // Highlight keywords. Must be done at once to prevent conflicts ('strong' and '<strong>').
-  $text = preg_replace('/' . $boundary . '(' . implode('|', $keys) . ')' . $boundary . '/iu', '<strong>\0</strong>', $text);
+  //$text = preg_replace('/' . $boundary . '(' . implode('|', $keys) . ')' . $boundary . '/iu', '<strong>\0</strong>', $text);
+  $text = preg_replace('/'. $boundary . '[' . RUSTEMMER_CHARS . ']*' .'('. implode('|', $keys) .')'. '[' . RUSTEMMER_CHARS . ']*' . $boundary .'/iu', '<strong>\0</strong>', $text);
   return $text;
 }
 
