Revision 794
- Date:
- 2020/05/27 11:08:12
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/sphinx/lib/sphinx/Keeper.pm
38 38 object_id => $doc->id, 39 39 object_class => $doc->class, 40 40 ); 41 if ( $doc->status == 1 ) { 41 if ( $doc->status ) { 42 42 my $data = $doc->get_search_data; 43 43 if ( ref $object && !$data ) { 44 44 $object->delete; 45 } else { 46 45 return undef; 47 46 } 48 47 unless ( ref $object ) { … … 188 187 } 189 188 190 189 my $query = "SELECT ".($count ? 'count(*) as cnt' : '*, weight() as weight')." FROM $db_table WHERE ".join( ' AND ', @wheres ).(@orders ? " ORDER BY ".join(', ', @orders) : ''); 190 if ( $limit && $offset ) { 191 $query .= " LIMIT $offset, $limit "; 192 } elsif ( $limit ) { 193 $query .= " LIMIT 0, $limit "; 194 } 191 195 if ( ref $weights eq 'HASH' ) { 192 196 my @weights; 193 197 foreach my $field ( keys %$weights ) { … … 197 201 $query .= " OPTION field_weights=(".join(', ', @weights).") "; 198 202 } 199 203 } 200 if ( $limit && $offset ) { 201 $query .= " LIMIT $offset, $limit "; 202 } elsif ( $limit ) { 203 $query .= " LIMIT 0, $limit "; 204 } 205 204 warn "SEARCH QUERY: $query\n" if $DEBUG; 206 205 warn "SEARCH VALUES: ".Dumper( \@values ) if $DEBUG; 207 206 my $sth = $self->SQL->prepare( $query );