added support for single results
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Nov 2010 16:01:49 +0000 (17:01 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Nov 2010 16:01:49 +0000 (17:01 +0100)
This shows result page directly, so it needed another regex to recognize it.
Both regexes are depend on Croatian language in interface, but they
are marked in code with FIXME for easy modification

Aleph.pm

index 2084a27..ef9470e 100644 (file)
--- a/Aleph.pm
+++ b/Aleph.pm
@@ -103,9 +103,11 @@ diag "submit search [$query] on ", $self->{database};
        );
 
        my $hits = 0;
-       if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)}s ) {
+       if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)}s ) { # FIXME Many results in Crotian
                $hits = $1;
                $hits = $2 if $2 && $2 < $1; # correct for max. results
+       } elsif ( $mech->content =~ m{(\d+)\s+od\s+(\d+)}s ) { # FIXME single result in Croatian
+               $hits = $2;
        } else {
                diag "get't find results in ", $mech->content;
                return;