[Dbix-class] DBIx-Class-ResultSet-AdvancedWebSearch

Zbigniew Lukasiak zzbbyy at gmail.com
Fri Sep 26 08:07:31 BST 2008


Thanks for the patches!   Nice simplification. Applied :)

If Matt gives me some svn space for it I'll put it into the DBIC
repository - so it'll be easier to collaborate.

In any way - what is still lacking is some trick to include the more
complex queries (like searching by tags) in the body of the module
instead of the tests.

Cheers,
Zbigniew

On Thu, Sep 25, 2008 at 10:39 PM, Marc Mims <marc at questright.com> wrote:
> * Ash Berlin <ash_cpan at firemirror.com> [080925 11:00]:
>>
>> On 25 Sep 2008, at 17:19, Marc Mims wrote:
>>
>>> * Marc Mims <marc at questright.com> [080925 08:48]:
>>>> All tests pass with the patch applied.
>>>
>>> I did, indeed, mirsead the code.  Here's a version that returns the
>>> correct $full_name and join condition.
>>>
>>
>> Interesting. that would mean that the tests don't cover enough? Fancy
>> patching them a bit to improve coverage/break with the old patch applied
>> too?
>
> Sure.  This patch adds a test for a deep join condition.  It fails with
> my old patch, passes with the new one (and the original code).
>
>        -Marc
>
> diff --git a/t/advanced_search.t b/t/advanced_search.t
> index baebb39..fc36288 100644
> --- a/t/advanced_search.t
> +++ b/t/advanced_search.t
> @@ -3,7 +3,7 @@
>  use lib 't/lib';
>  use DBSchema;
>  use Test::More;
> -plan tests => 4;
> +plan tests => 5;
>
>  my $schema = DBSchema::get_test_schema();
>  my $dvd_rs = $schema->resultset( 'Dvd' );
> @@ -17,3 +17,7 @@ is( $new_rs->count, 2, 'Related like searching' );
>  $new_rs = $dvd_rs->advanced_search( { tags => [ 'australian', 'dramat' ] } );
>  is( $new_rs->count, 1, 'Searching by tags' );
>
> +my $user_rs = $schema->resultset('User');
> +$new_rs = $user_rs->advanced_search({ 'owned_dvds.dvdtags.tag.name' => 'comedy' });
> +is( $new_rs->count, 2, 'Deep join' );
> +
> diff --git a/t/lib/DBSchema/ResultSet/User.pm b/t/lib/DBSchema/ResultSet/User.pm
> new file mode 100644
> index 0000000..c3123c0
> --- /dev/null
> +++ b/t/lib/DBSchema/ResultSet/User.pm
> @@ -0,0 +1,8 @@
> +use strict;
> +use warnings;
> +
> +package DBSchema::ResultSet::User;
> +
> +use base 'DBIx::Class::ResultSet::AdvancedWebSearch';
> +
> +1;
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the DBIx-Class mailing list