Development

#2757 (sfLucene : highlight errors with utf8 accentuated chars when escaping is on)

You must first sign up to be able to contribute.

Ticket #2757 (assigned defect)

Opened 6 months ago

Last modified 4 months ago

sfLucene : highlight errors with utf8 accentuated chars when escaping is on

Reported by: antoine Assigned to: Carl.Vondrick (accepted)
Priority: minor Milestone:
Component: sfLucenePlugin Version:
Keywords: Cc:
Qualification: Patch rejected, quality issue

Description

To fix it:

in the partial app/frontend/modules/sfLucene/templates/_modelResult:

(You should also modify the partial _actionResult)

<?php $query = html_entity_decode($sf_data->getRaw('query'), ENT_NOQUOTES, sfConfig::get('sf_charset')) ?>

<?php echo link_to(highlight_keywords($result->getInternalTitle(ESC_RAW), $query, sfConfig::get('app_lucene_result_highlighter', '<strong class="highlight">%s</strong>')), add_highlight_qs($result->getInternalUri(), $query)) ?> (<?php echo $result->getScore() ?> %)
<p><?php echo highlight_result_text(__($result->getInternalDescription(ESC_RAW)), $query, sfConfig::get('app_lucene_result_size', 200), sfConfig::get('app_lucene_result_highlighter', '<strong class="highlight">%s</strong>')) ?></p>

Change History

01/03/08 22:05:37 changed by Carl.Vondrick

  • owner changed from fabien to Carl.Vondrick.
  • version deleted.
  • component changed from other to sfLucenePlugin.

01/04/08 10:34:13 changed by antoine

There is also a bug in the helper sfLuceneHelper.php in the function add_highlight_qs()

The preg need the u modifier because of unicode chars.

replace:

$keywords = preg_split('/\W+/', $keywords, -1, PREG_SPLIT_NO_EMPTY);

by

$keywords = preg_split('/[\W]+/u', $keywords, -1, PREG_SPLIT_NO_EMPTY);

And

replace

if (preg_match('/(#\w+)$/', $query, $matches, PREG_OFFSET_CAPTURE))

by

if (preg_match('/(#[\w]+)$/u', $query, $matches, PREG_OFFSET_CAPTURE))

01/19/08 18:17:47 changed by Carl.Vondrick

  • status changed from new to assigned.

Depends on #2809 for 1.1 branch.

01/19/08 18:58:55 changed by Carl.Vondrick

Unicode modifier added in r7088.

03/14/08 05:56:41 changed by Carl.Vondrick

  • qualification changed from Unreviewed to Patch rejected, quality issue.

Can you provide a unified diff?