diff options
author | chris <chris@jalakai.co.uk> | 2006-08-31 11:21:46 +0200 |
---|---|---|
committer | chris <chris@jalakai.co.uk> | 2006-08-31 11:21:46 +0200 |
commit | 0e70946d23660c4814db46cd3f89cb8340e51336 (patch) | |
tree | afe4516d890cb5e6192bda9584427b0af80c97fe /inc | |
parent | 9ee93076cf04a466d2e9620bc3efe538d93e5983 (diff) | |
download | rpg-0e70946d23660c4814db46cd3f89cb8340e51336.tar.gz rpg-0e70946d23660c4814db46cd3f89cb8340e51336.tar.bz2 |
add unittests for bug#891
darcs-hash:20060831092146-9b6ab-b00aa29c982ab18117f476b3d01d5111915c9d4b.gz
Diffstat (limited to 'inc')
-rw-r--r-- | inc/fulltext.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php index fa3ec05d2..280ba0c89 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -333,7 +333,6 @@ switch ($algorithm) { // establish context, 100 bytes surrounding the match string // first look to see if we can go 100 either side, // then drop to 50 adding any excess if the other side can't go to 50, - // NOTE: these are byte adjustments and will have to be corrected for utf-8 $pre = min($utf8_idx-$utf8_offset,100); $post = min($len-$utf8_idx-$utf8_len,100); @@ -371,9 +370,9 @@ switch ($algorithm) { } else { // code for strings too large for utf8_substr // use a larger context number as its bytes not characters - $pre = 70; + // no need to check for short pre, $idx is nearly 64k $post = min(strlen($text)-$idx-strlen($str), 70); - if ($post < 70) { $pre = 70 - $post; } + $pre = ($post < 70) ? 140 - $post : 70; $start = utf8_correctIdx($text,$idx - $pre); $end = utf8_correctIdx($text, $idx + strlen($str) + $post); |