thank you for the feedback, felix,
so, for a start, i will just check if there's a exact match for
title/name fields.
if not found, try a more broad regex LIKE '%$conditions%' for title/name ,
if not found, search in other fields
$conditions = $this->params['url']['s'];
$results['exact']['filme'] = $this->Filme->findAll(array('title'=>$conditions));
if not found
$results['fuzzy']['filme'] = $this->Filme->findAll("title LIKE
'%".$conditions."%'");
if not found
$results['full']['filme'] = $this->Filme->findAll("slug LIKE
'%".$conditions."%' OR titulo_original LIKE '%".$conditions."%' OR
titulo_ingles LIKE '%".$conditions."%' OR sinopse LIKE
'%".$conditions."%' OR description LIKE '%".$conditions."%'");
and use that array on the view
looks simple and effective, but i'll post when i can make something better
thank you
spark
On 7/19/06, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
> Hi spark,
>
> unfortunately the code I've written was for searching local files and
> doesn't make usage of several advantages you've
> got when working with databases, so it would not be worth for you trying to
> apply it to your own solution. Other then that
> I've written some regex that will parse the queries, so "connected
> keywords" will be recognized and stupid user mistakes
> like doubling keywords will be ignored. But if you are good with regex
> yourself that shouldn't take you that long.
>
> Regarding ranking, there is almost no limit on the complexity of the
> algorithm you may use to determine one items
> popularity. I think user feedback should be weighted pretty high, but only
> if the input can be trusted. And to determine
> trusted feedback from spam & manipulation can be pretty tricky. So this
> isn't something I would completely rely on, when
> implementing search in a site where advantages can be taken from having
> certain items high up in the serps (search result
> pages).
>
> A better solution is to put efforts into understanding the relationships of
> the items you are trying to compare. Now, when searching
> your own database, you are in the lucky situation that you can track things
> like item popularity, creation / updated time stamps and
> tons of other useful information, just like Amazon does with "Other people
> who liked this product also bought ..." that you wouldn't be
> able to track, when searching through foreign databases (or web sites). Of
> course, this is sort of suffering from similar problems
> like the idea of taking user feedback.
>
> So again, I think it would be really nice to have a generic search solution
> for cakephp that's based on a central Search Model that
> get's it's informations from special Crawler (Components?) written by the
> community. This would be quite challenging, but as a result,
> we could have a common data interface for the applications we write with,
> that we could make available as a web service. I'm sure
> there are tons of sweet things we could do with that.
>
> Alright, but before I start to sound like an employee of this big company
> that tries to index the entire world, I'll stop here and leave it
> to you to figure out what will be the best solution for the site you are
> creating ; ).
>
>
> Best Regards,
> Felix Geisendörfer
>
> --------------------------
> http://www.thinkingphp.org
> http://www.fg-webdesign.de
>
> DJ Spark schrieb:
> quite elegant solution, gwoo ! thanx!
>
> i'm also working on a tiny search for a project in cakephp, Felix.
> Anyone have some references on search enhancements? ( like that in
> youtube, for example, where a string is sent and it says it comes from
> a search result, a ranks it better on the next search for the same
> term).
> Any article related would be a good reading for me at this point ;)
>
> spark
>
>
>
> On 7/19/06, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
>
> Well you could refactor the Search functionality into an own model, which
> would make
> sense to me. But you don't necessarily have to do that. You can put this in
> any controller
> to say that no Model is being used:
>
> var $uses = array();
>
> But really, if you plan to implement a quality search into a high usage web
> site, you should
> seriously consider maintaining an own search index as well as to do some
> regex on the
> queries (so users can use "two words" and such). Once you get into this
> topic you'll find out,
> that doing a good job on search (even for your own db), is not all that
> easy. I mean you can
> literally spend 50 hours (and more ...) to write the code required for an
> intelligent search tool.
> I've worked on a file search tool for my personal use in CakePHP, and I was
> really surprised
> about the complexity that comes with it. If I find some time this sommer I
> might try to create a
> Generic Search Model for CakePHP, that will work together with different
> types of crawlers you
> can create by yourself (DB Tables, RSS feeds, Html, XML, Image Meta data,
> ...). I think it's quite
> an interesting topic and if anybody else would be interested in it it might
> well be worth a little
> CakeForge project.
>
> Best Regards,
> Felix Geisendörfer
>
> --------------------------
> http://www.thinkingphp.org
> http://www.fg-webdesign.de
>
> carlosrg schrieb:
> But, we need a model for this Controller, it's ok? What should be the
> model?
>
>
>
>
>
>
> >
>
>
>
>
>
>
> >
>
>
--
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---