projects
/
BackupPC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b1b5504
)
implement numeric padding
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 11 Jan 2011 18:02:27 +0000
(18:02 +0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 11 Jan 2011 18:02:27 +0000
(18:02 +0000)
lib/BackupPC/Search/KinoSearch.pm
patch
|
blob
|
history
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 );
}