you can search for can't or don't too, words with single quotes

This commit is contained in:
SJ 2012-09-18 17:11:40 +02:00
parent 7de23a3b1d
commit 4d4982a9c6

View File

@ -232,11 +232,13 @@ class ModelSearchSearch extends Model {
$match = $this->assemble_email_address_condition($data['from'], $data['to']);
if($data['body']) {
$data['body'] = $this->fixup_meta_characters($data['body']);
$data['body'] = $this->fixup_sphinx_operators($data['body']);
if($match) { $match .= " & "; } $match .= "(@body " . $data['body'] . ") ";
}
if($data['subject']) {
$data['subject'] = $this->fixup_meta_characters($data['subject']);
$data['subject'] = $this->fixup_sphinx_operators($data['subject']);
if($match) { $match .= " & "; } $match .= "(@subject " . $data['subject'] . ") ";
}
@ -245,6 +247,7 @@ class ModelSearchSearch extends Model {
if($data['any']) {
$data['any'] = $this->fixup_meta_characters($data['any']);
$data['any'] = $this->fixup_sphinx_operators($data['any']);
$data['any'] = $this->fix_email_address_for_sphinx($data['any']);
if($match) { $match = "($match) & "; } $match .= "(@subject,@body" . $data['any'] . ") ";
@ -645,6 +648,15 @@ class ModelSearchSearch extends Model {
}
private function fixup_meta_characters($s = '') {
if($s == '') { return $s; }
$s = preg_replace("/\'/", ' ', $s);
return $s;
}
private function fixup_sphinx_operators($s = '') {
if($s == '') { return $s; }