If you use Stackoverflow, you may have seen me flailing around over
the last couple of days trying to get pagination to work nicely with a
full-text search.
In the course of this flailing I've had a few ideas about potential
additions to Cake that would make this sort of operation easier and
more Cake-like. At present, it's not a neat fit; sneaking the correct
parameters into Cake's (otherwise invaluable) methods is an ugly
solution.
NB I'm using v1.2 (don't ask), but as far as I can tell these
improvements would benefit 1.3 and 2.0 too.
Idea 1: Native support for derived fields. Instead of this:
'fields' => array("*, match(Tournament.Name) against ('".$query."'
in boolean mode) as score"),
I'd like to be able to do something like this:
'derived' => array('score' => "match(Tournament.Name) against ('".
$query."' in boolean mode)"),
I should then be able to use this as a first-class field. Cake should
be able to work out when a condition needs to go in a "where" and when
it needs to go into a "having" (or the equivalents in non-MySQL DBs).
In my specific case this would have meant that I wouldn't have had to
sneak a having clause into Cake via "group by".
Idea 2: A paginate-esque way of handling searches.
Searches (full-text or otherwise) are a sufficiently complex,
standardised, and repetitive functionality to warrant a special helper
like paginate. I suppose it would extend paginate. Additionally
searches are, I suspect, one of the areas in which DBs differ
significantly from one another.
I might try to implement these additions, but I wanted to get feedback
first to make sure:
a) I'm wouldn't be duplicating existing functionality
b) Nobody else is working on something similar
c) It's worth doing
Cheers,
Tom
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment