improved the expert search

This commit is contained in:
SJ 2012-08-28 22:00:45 +02:00
parent 1c2ed0d5bb
commit 222a3aa355
4 changed files with 28 additions and 10 deletions

View File

@ -62,14 +62,6 @@ create index metadata_idx5 on metadata(`deleted`);
create index metadata_idx6 on metadata(`arrived`);
create index metadata_idx7 on metadata(`retained`);
drop table if exists `folder`;
create table if not exists `folder` (
`id` int not null auto_increment,
`parent_id` int default 0,
`name` char(64) not null unique,
primary key (`id`)
) Engine=InnoDB;
drop table if exists `rcpt`;
create table if not exists `rcpt` (
@ -246,6 +238,21 @@ create table if not exists `group_email` (
) ENGINE=InnoDB;
create table if not exists `folder` (
`id` int not null auto_increment,
`parent_id` int default 0,
`name` char(64) not null unique,
primary key (`id`)
) Engine=InnoDB;
create table if not exists `notes` (
`id` bigint unsigned not null,
`note` text default null,
key `notes_idx` (`id`)
) ENGINE=InnoDB;
create table if not exists `remote` (
`remotedomain` char(64) not null primary key,
`remotehost` char(64) not null,

View File

@ -1,6 +1,5 @@
alter table `sph_index` add column `folder` int default 0;
drop table if exists `folder`;
create table if not exists `folder` (
`id` int not null auto_increment,
`parent_id` int default 0,
@ -8,4 +7,9 @@ create table if not exists `folder` (
primary key (`id`)
) Engine=InnoDB;
create table if not exists `notes` (
`id` bigint unsigned not null,
`note` text default null,
key `notes_idx` (`id`)
) ENGINE=InnoDB;

View File

@ -20,7 +20,8 @@ class ControllerSearchHelper extends Controller {
'size' => '',
'attachment_type' => '',
'tag' => '',
'ref' => ''
'ref' => '',
'any' => ''
);
@ -137,6 +138,7 @@ class ControllerSearchHelper extends Controller {
else if($v == 'size') { $token = 'size'; continue; }
else if($v == 'tag:') { $token = 'tag'; continue; }
else if($v == 'ref:') { $token = 'ref'; continue; }
else { $this->a['any'] .= ' ' . $v; }
if($token == 'from') {
$v = fix_email_address($v);

View File

@ -103,6 +103,9 @@ class ModelSearchSearch extends Model {
$data['body'] = $this->fixup_sphinx_operators($data['body']);
$data['subject'] = $this->fixup_sphinx_operators($data['subject']);
$data['any'] = $this->fixup_sphinx_operators($data['any']);
$data['any'] = $this->fix_email_address_for_sphinx($data['any']);
if(Registry::get('auditor_user') == 1) {
if($data['f_from']) { $f1 .= "|" . $data['f_from']; $n_fc++; }
@ -167,6 +170,8 @@ class ModelSearchSearch extends Model {
if($data['subject']) { if($match) { $match .= " & "; } $match .= "(@subject " . $data['subject'] . ") "; }
if($data['attachment_type'] && $data['attachment_type'] != "any") { if($match) { $match .= " & "; } $match .= "(@attachment_types " . $data['attachment_type'] . ") "; }
if($data['any']) { if($match) { $match .= " & "; } $match .= "(" . $data['any'] . ") "; }
return $match;
}