numeric_padding values are used in range search, and muse be sortable
[BackupPC.git] / lib / BackupPC / Search / KinoSearch.pm
index e3431b5..a745415 100644 (file)
@@ -11,6 +11,8 @@ use Data::Dump qw(dump);
 
 # my $tokenizer = KinoSearch::Analysis::Tokenizer->new( pattern => '\\w' );
 
+# numeric_padding values are used in range search, and muse be sortable
+
 sub new {
        my $class = shift @_;
        my %Conf = @_;
@@ -23,7 +25,6 @@ sub new {
                numeric_padding => [ qw(
                        backup_date
                        date
-                       size
                ) ],
 
        }, $class;
@@ -54,7 +55,6 @@ sub indexer {
 
        # numeric
        $schema->spec_field( name => $_, type => $string_type ) foreach ( qw/
-               backup_date
                fid
                shareid
                type
@@ -75,6 +75,7 @@ sub indexer {
        # sortable numeric
        $schema->spec_field( name => $_, type => $sort_type ) foreach (qw/
                backupnum
+               backup_date
                date
                size
        /);
@@ -118,7 +119,7 @@ sub exists {
        return $hits->total_hits;
 }
 
-sub _numeric_padding { sprintf "%011d", $_[0] }
+sub _numeric_padding { sprintf "%010d", $_[0] } # pad up to 32bit number (timestamp)
 
 sub add_doc {
        my ($self,$row) = @_;