Revision 658

Date:
2017/07/06 17:36:03
Author:
ahitrov
Revision Log:
Sorting bugs

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/sphinx/lib/sphinx/Keeper.pm

     
    75 75 my $db_table = delete $opts{db_table} || $self->state->table_name;
    76 76 my @wheres = ("MATCH(?)");
    77 77 my @values = ($text);
    78 my @orders;
    78 79 my $count = delete $opts{count};
    79 80 my $limit = delete $opts{limit};
    80 81 return if $limit && ($limit =~ /\D/ || $limit < 0);
     
    96 97 push @values, ref $opts{object_class} ? @{$opts{object_class}} : $opts{object_class};
    97 98 }
    98 99
    99 my $query = "select ".($count ? 'count(*) as cnt' : '*, weight() as weight')." from $db_table where ".join( ' and ', @wheres );
    100 if ( exists $opts{order_by} ) {
    101 push @orders, $opts{order_by};
    102 } elsif ( !$count ) {
    103 push @orders, 'weight desc, last_edited desc';
    104 }
    105
    106 my $query = "select ".($count ? 'count(*) as cnt' : '*, weight() as weight')." from $db_table where ".join( ' and ', @wheres ).(@orders ? " order by ".join(', ', @orders) : '');
    100 107 if ( $limit && $offset ) {
    101 108 $query .= " limit $offset, $limit ";
    102 109 } elsif ( $limit ) {
     
    175 182 my $dbh = DBI->connect('DBI:mysql:host='.$self->{db_host}.';port='.$self->{db_port}.';mysql_enable_utf8=1')
    176 183 || die "Contenido Error: Не могу соединиться с Sphinx базой данных\n";
    177 184
    185 $dbh->{mysql_auto_reconnect} = 1;
    178 186 # $dbh->{'AutoCommit'} = 1;
    179 # $dbh->{mysql_auto_reconnect} = 1;
    180 187
    181 188 return $dbh;
    182 189 }