[Catalyst] Search example in any docs?

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Sep 23 21:02:43 BST 2008


On Tue, Sep 23, 2008 at 9:38 PM, Dr. Jennifer Nussbaum
<bg271828 at yahoo.com> wrote:
> Hi.
>
> Im working on a new app which is working well. While doing it though i realised that i never get my serach done right. I mean, it works, but
> i end up spending a lot of code munging parameters, making adjustments,
> and so forth, and this cant be right. What should be a few lines takes a page or two of code, just for a simple one or two table search.
>
> I tried looking through the docs for a best-practices approach and unless i missed something there arent ANY examples of search in the docs, the tutorial, the wiki, the Advent.... (Oh in one place there was something about harder searches, fulltext in PostGres, but nothing general.)
>
> Is there any place that shows a simple example of a web form -> DBIC search in Catalyst? And if not, shouldnt there be?

Hi there,

I am sure you are referring to
http://www.catalystframework.org/calendar/2007/16 :)  I don't really
know what you need, but I start that article with a very a simple
solution:

my @records = $schema->ResultSet( 'MyTable' )->search(
        $reqest->params,
        { page => 1, rows => 5 }
    );

Only after presenting that I start discussing what to do when you need
to add some more complex predicates to the query and propose a
solution to that.

Of course that article ignores the part of generating the HTML form
code and getting the parameters from $c - I had to concentrate on
somethign.

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



More information about the Catalyst mailing list