X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FSearch%2FKinoSearch.pm;h=e1ba8dad8909bfe1f490cbae7ca3cca7f233a8a7;hp=67eff7e8e3022f1af1e8320973c9993b175e516b;hb=63948b2b693c57faa83050d7590bbf11acc3388c;hpb=2630cbae3c9db4d44a7fd754f8a1deaefde0dc5e diff --git a/lib/BackupPC/Search/KinoSearch.pm b/lib/BackupPC/Search/KinoSearch.pm index 67eff7e..e1ba8da 100644 --- a/lib/BackupPC/Search/KinoSearch.pm +++ b/lib/BackupPC/Search/KinoSearch.pm @@ -43,22 +43,34 @@ sub indexer { ); my $blob_type = KinoSearch::Plan::BlobType->new( stored => 1 ); my $string_type = KinoSearch::Plan::StringType->new; # non-tokenized - my $num_type = KinoSearch::Plan::Int64Type->new; + my $num_type = KinoSearch::Plan::Int64Type->new( sortable => 1 ); + my $sort_type = KinoSearch::Plan::StringType->new( sortable => 1 ); # non-tokenized # numeric $schema->spec_field( name => $_, type => $string_type ) foreach ( qw/ backup_date backupnum - date fid shareid - size type / ); # non-tokenized strings $schema->spec_field( name => $_, type => $string_type ) foreach ( qw/ - _uri filepath hname sname + _uri + hname + /); + + # sortable + $schema->spec_field( name => $_, type => $sort_type ) foreach (qw/ + sname + filepath + /); + + # sortable numeric + $schema->spec_field( name => $_, type => $sort_type ) foreach (qw/ + date + size /); # tokenized magic columns for infix search @@ -134,9 +146,11 @@ sub search { my $sort_spec = KinoSearch::Search::SortSpec->new( rules => $rules ); -# $q =~ s/(.)/$1 /g; + my $split = $q; + $split =~ s/(.)/$1 /g; # _file_path_split + $split = qq{"$split"}; # exact ordering my $hits = $self->searcher->hits( - query => $q, + query => $split, sort_spec => $sort_spec, );