Subject: | Modify query wildcard behavior - best method? |
Date: | Wed, 3 Dec 2008 17:16:06 -0800 |
To: | bug-catalystx-crud [...] rt.cpan.org |
From: | "Gordon Pedersen" <gordon [...] visi.com> |
Hi Peter,
For the most part in the apps I support I want a different SQL query
wildcard behavior than is stock with CatalystX::CRUD.
Right now I use a 'cxc-fuzzy' param in my search form to turn out a WHERE
clause like "my_column LIKE 'my_val%'". Works fine.
But what I want is to have a WHERE clause like this: "my_column LIKE
'%my_val%'" - ie, put the '%' at both ends.
I don't want to change the behavior triggered by 'cxc-fuzzy'.
I either want to introduce a new variable, say 'csx-dbl-fuzzy', to trigger
the desired behavior. This would seem to require changes to
Search::QueryParser::SQL::Query::_orm_subq (sp?) and I don't want to mess
with that.
Or it looks like I can surround all non-empty search form fields with
asterisk at both ends before passing on to the do_search method and the
above "_orm_subq" method will do the right thing.
I'm not sure the best place/method to do the latter. Your examples or
suggestions are solicited. Especially if it seems that I'm looking at this
the wrong way.
Thanks.
--
Gordon Pedersen