summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-05-14 15:07:25 +0000
committerDries Buytaert <dries@buytaert.net>2008-05-14 15:07:25 +0000
commit7b98fa400830dae12f518fd25aaf4742c1c75d9c (patch)
tree8db1147ab3a15dcf80fa7a899b9ac4ea78f5520d /modules
parent21137e1aed33add659b0105de871de2450d5b2db (diff)
downloadbrdo-7b98fa400830dae12f518fd25aaf4742c1c75d9c.tar.gz
brdo-7b98fa400830dae12f518fd25aaf4742c1c75d9c.tar.bz2
- Patch #237754 by Robert Douglass and David Lesieur: search_index hardcoded the weights of HTML elements. Made them configurable through variable_get().
Diffstat (limited to 'modules')
-rw-r--r--modules/search/search.module28
1 files changed, 15 insertions, 13 deletions
diff --git a/modules/search/search.module b/modules/search/search.module
index fe2e32793..484bfadb9 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -423,20 +423,22 @@ function search_index($sid, $type, $text) {
global $base_url;
$node_regexp = '@href=[\'"]?(?:' . preg_quote($base_url, '@') . '/|' . preg_quote(base_path(), '@') . ')(?:\?q=)?/?((?![a-z]+:)[^\'">]+)[\'">]@i';
- // Multipliers for scores of words inside certain HTML tags.
+ // Multipliers for scores of words inside certain HTML tags. The weights are stored
+ // in a variable so that modules can overwrite the default weights.
// Note: 'a' must be included for link ranking to work.
- $tags = array('h1' => 25,
- 'h2' => 18,
- 'h3' => 15,
- 'h4' => 12,
- 'h5' => 9,
- 'h6' => 6,
- 'u' => 3,
- 'b' => 3,
- 'i' => 3,
- 'strong' => 3,
- 'em' => 3,
- 'a' => 10);
+ $tags = variable_get('search_tag_weights', array(
+ 'h1' => 25,
+ 'h2' => 18,
+ 'h3' => 15,
+ 'h4' => 12,
+ 'h5' => 9,
+ 'h6' => 6,
+ 'u' => 3,
+ 'b' => 3,
+ 'i' => 3,
+ 'strong' => 3,
+ 'em' => 3,
+ 'a' => 10));
// Strip off all ignored tags to speed up processing, but insert space before/after
// them to keep word boundaries.