- Alternative fix for search module bug.

4.5.x
Dries Buytaert 2004-07-28 20:32:21 +00:00
parent 4c630e8fe6
commit cd632f6251
2 changed files with 4 additions and 8 deletions

View File

@ -279,7 +279,7 @@ function update_index($search_array) {
// Walk through the array, giving a "weight" to each word based on // Walk through the array, giving a "weight" to each word based on
// the number of times it appears in a page. // the number of times it appears in a page.
foreach ($eachword as $word) { foreach ($eachword as $word) {
if (strlen($word) >= $minimum_word_size) { if (strlen($word) >= $minimum_word_size && strlen($word) <= 50) {
if ($newwords[$word]) { if ($newwords[$word]) {
$newwords[$word]++; $newwords[$word]++;
} }
@ -293,11 +293,9 @@ function update_index($search_array) {
// the search index. // the search index.
if ($newwords) { if ($newwords) {
foreach ($newwords as $key => $value) { foreach ($newwords as $key => $value) {
if (strlen($key) <= 50) {
db_query("INSERT INTO {search_index} VALUES('%s', %d, '%s', %d)", $key, $node['lno'], $node_type, $value); db_query("INSERT INTO {search_index} VALUES('%s', %d, '%s', %d)", $key, $node['lno'], $node_type, $value);
} }
} }
}
// Reset the weighted words array, so we don't add multiples. // Reset the weighted words array, so we don't add multiples.
$newwords = array (); $newwords = array ();

View File

@ -279,7 +279,7 @@ function update_index($search_array) {
// Walk through the array, giving a "weight" to each word based on // Walk through the array, giving a "weight" to each word based on
// the number of times it appears in a page. // the number of times it appears in a page.
foreach ($eachword as $word) { foreach ($eachword as $word) {
if (strlen($word) >= $minimum_word_size) { if (strlen($word) >= $minimum_word_size && strlen($word) <= 50) {
if ($newwords[$word]) { if ($newwords[$word]) {
$newwords[$word]++; $newwords[$word]++;
} }
@ -293,11 +293,9 @@ function update_index($search_array) {
// the search index. // the search index.
if ($newwords) { if ($newwords) {
foreach ($newwords as $key => $value) { foreach ($newwords as $key => $value) {
if (strlen($key) <= 50) {
db_query("INSERT INTO {search_index} VALUES('%s', %d, '%s', %d)", $key, $node['lno'], $node_type, $value); db_query("INSERT INTO {search_index} VALUES('%s', %d, '%s', %d)", $key, $node['lno'], $node_type, $value);
} }
} }
}
// Reset the weighted words array, so we don't add multiples. // Reset the weighted words array, so we don't add multiples.
$newwords = array (); $newwords = array ();