Changeset 2464

Show
Ignore:
Timestamp:
05/30/08 04:11:16 (6 months ago)
Author:
bchoate
Message:

Can't optimize with join when not operator is used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-39/lib/MT/Template/ContextHandlers.pm

    r2463 r2464  
    76567656            } 
    76577657            if ( !$entries ) { 
    7658                 $args{join} = MT::Placement->join_on( 'entry_id', { 
    7659                         category_id => \@cat_ids, %blog_terms 
    7660                     }, { %blog_args, unique => 1 } ); 
     7658                if ($category_arg !~ m/\bNOT\b/i) { 
     7659                    $args{join} = MT::Placement->join_on( 'entry_id', { 
     7660                            category_id => \@cat_ids, %blog_terms 
     7661                        }, { %blog_args, unique => 1 } ); 
     7662                } 
    76617663            } 
    76627664            push @filters, sub { $cexpr->($_[0]->id, \%map) }; 
    76637665        } else { 
    7664             if (! $category_arg ) { 
    7665                 return $ctx->error(MT->translate("You have an error in your '[_2]' attribute: [_1]", $category_arg, $class_type eq 'entry' ? 'category' : 'folder')); 
    7666             } 
     7666            return $ctx->error(MT->translate("You have an error in your '[_2]' attribute: [_1]", $category_arg, $class_type eq 'entry' ? 'category' : 'folder')); 
    76677667        } 
    76687668    } 
     
    77047704            }; 
    77057705            if (!$entries) { 
    7706                 $args{join} = MT::ObjectTag->join_on( 'object_id', { 
    7707                         tag_id => \@tag_ids, object_datasource => 'entry', 
    7708                         %blog_terms 
    7709                     }, { %blog_args, unique => 1 } ); 
     7706                if ($tag_arg !~ m/\bNOT\b/i) { 
     7707                    $args{join} = MT::ObjectTag->join_on( 'object_id', { 
     7708                            tag_id => \@tag_ids, object_datasource => 'entry', 
     7709                            %blog_terms 
     7710                        }, { %blog_args, unique => 1 } ); 
     7711                } 
    77107712            } 
    77117713            push @filters, sub { $cexpr->($preloader->($_[0]->id)) }; 
     
    79127914                    last unless --$limit; 
    79137915                } 
    7914                 $no_resort = 1 unless $args->{sort_order} || $args->{sort_by}
     7916                $no_resort = $args->{sort_order} || $args->{sort_by} ? 0 : 1
    79157917            } else { 
    79167918                @entries = $class->load(\%terms, \%args); 
     
    79307932                $iter = _rco_entries_iter( 
    79317933                    \%terms, \%args, \%blog_terms, \%blog_args); 
    7932                 $no_resort = 1 unless $args->{sort_order} || $args->{sort_by}
     7934                $no_resort = $args->{sort_order} || $args->{sort_by} ? 0 : 1
    79337935            } else { 
    79347936                $iter = $class->load_iter(\%terms, \%args);