Permalink
Browse files

More tracing!

  • Loading branch information...
1 parent a73ce18 commit 81c1280ab40a8160f4d6023b61cdf1c5277bcd06 @Getty Getty committed Mar 5, 2013
Showing with 7 additions and 1 deletion.
  1. +4 −1 lib/DDG/Block.pm
  2. +3 −0 lib/DDG/Block/Words.pm
View
@@ -300,7 +300,10 @@ sub handle_request_matches {
my ( $self, $plugin, $request, @args ) = @_;
my $plugin_class = ref $plugin;
unless ($self->allow_duplicate) {
- return () if grep { $_ eq $plugin_class } @{$request->seen_plugins};
+ if (grep { $_ eq $plugin_class } @{$request->seen_plugins}) {
+ $self->trace("The request already saw","'".$plugin_class."'");
+ return ();
+ }
}
push @{$request->seen_plugins}, $plugin_class;
return $plugin->handle_request_matches($request, @args);
View
@@ -169,6 +169,7 @@ sub request {
for my $sofar_word (@sofar_words) {
if (defined $hitstruct->{$word_count}->{$sofar_word}) {
for (@{$hitstruct->{$word_count}->{$sofar_word}}) {
+ $self->trace('Handle request matches:',ref $_,"'".$request->query_raw."'",$pos);
push @results, $self->handle_request_matches($_,$request,$pos);
return @results if $self->return_one && @results;
}
@@ -187,6 +188,7 @@ sub request {
: join(" ",$next_trigger,$current_sofar_word);
if (defined $hitstruct->{$word_count}->{$new_next_word}) {
for (@{$hitstruct->{$word_count}->{$new_next_word}}) {
+ $self->trace('Handle request matches:',ref $_,"'".$request->query_raw."'",( $pos < $next_pos ) ? ( $pos,$next_pos ) : ( $next_pos,$pos ));
push @results, $self->handle_request_matches($_,$request,( $pos < $next_pos ) ? ( $pos,$next_pos ) : ( $next_pos,$pos ));
return @results if $self->return_one && @results;
}
@@ -198,6 +200,7 @@ sub request {
}
}
if (defined $hitstruct->{1}) {
+ $self->trace('Handle request matches:',ref $_,"'".$request->query_raw."'",$poses[$cnt]);
push @results, $self->handle_request_matches($_,$request,$poses[$cnt]) for @{$hitstruct->{1}};
return @results if $self->return_one && @results;
}

0 comments on commit 81c1280

Please sign in to comment.