-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalyzer-faster-stopwords.patch
More file actions
27 lines (24 loc) · 965 Bytes
/
analyzer-faster-stopwords.patch
File metadata and controls
27 lines (24 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: Doctrine/lib/Doctrine/Search/Analyzer/Standard.php
===================================================================
--- Doctrine.orig/lib/Doctrine/Search/Analyzer/Standard.php 2009-06-15 10:01:42.000000000 +0300
+++ Doctrine/lib/Doctrine/Search/Analyzer/Standard.php 2009-06-18 10:37:43.000000000 +0300
@@ -263,6 +263,13 @@
public function analyze($text, $encoding = null)
{
+ static $stopwords;
+
+ if (!isset($stopwords))
+ {
+ $stopwords = array_flip(self::$_stopwords);
+ }
+
$text = preg_replace('/[\'`´"]/', '', $text);
$text = Doctrine_Inflector::unaccent($text);
$text = preg_replace('/[^A-Za-z0-9]/', ' ', $text);
@@ -278,7 +285,7 @@
}
$lower = strtolower(trim($term));
- if (in_array($lower, self::$_stopwords)) {
+ if (isset($stopwords[$lower])) {
continue;
}