projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
implement numeric padding
[BackupPC.git]
/
lib
/
BackupPC
/
Search
/
KinoSearch.pm
diff --git
a/lib/BackupPC/Search/KinoSearch.pm
b/lib/BackupPC/Search/KinoSearch.pm
index
30cc073
..
e6f7c6a
100644
(file)
--- a/
lib/BackupPC/Search/KinoSearch.pm
+++ b/
lib/BackupPC/Search/KinoSearch.pm
@@
-46,6
+46,18
@@
sub indexer {
my $num_type = KinoSearch::Plan::Int64Type->new( sortable => 1 );
my $sort_type = KinoSearch::Plan::StringType->new( sortable => 1 ); # non-tokenized
my $num_type = KinoSearch::Plan::Int64Type->new( sortable => 1 );
my $sort_type = KinoSearch::Plan::StringType->new( sortable => 1 ); # non-tokenized
+=for numeric-no-padding
+ fid
+ shareid
+ type
+ backupnum
+=cut
+ $self->{numeric_padding} = [ qw/
+ backup_date
+ date
+ size
+ / ];
+
# numeric
$schema->spec_field( name => $_, type => $string_type ) foreach ( qw/
backup_date
# numeric
$schema->spec_field( name => $_, type => $string_type ) foreach ( qw/
backup_date
@@
-120,10
+132,14
@@
sub add_doc {
$path =~ s/(.)/$1 /g; # XXX our tokenize
$row->{_file_path_split} = $path;
$path =~ s/(.)/$1 /g; # XXX our tokenize
$row->{_file_path_split} = $path;
- warn "XXX ",dump($row) if $ENV{DEBUG};
-
$self->{stats}->{add_doc}++;
$self->{stats}->{add_doc}++;
+ foreach my $col ( @{ $self->{numeric_padding} } ) {
+ $row->{$col} = sprintf "%011d", $row->{$col};
+ }
+
+ warn "XXX ",dump($row) if $ENV{DEBUG};
+
$self->indexer->add_doc( $row );
}
$self->indexer->add_doc( $row );
}