check out http://bakery.cakephp.org/articles/view/sphinx-behavior and see if it fits your need?
On May 1, 9:00 am, mbourque <[email protected]> wrote: > I am building a data warehouse site that contains a lot of customer info. I > need to allow users of my app to have a search page that lets them enter > natural search strings to find and narrow search results. > > I wanted each word on the search field to be treated as AND clause in my > search. I also need the search to act like full text where multiple fields > are considered for a match. I also have a special case whereas a numeric > keyword is treated special and only certain fields are searched in that > case. > > Examples: > > Keyword: dave > Searches: ( `User`.`name` like '%dave%' OR `User`.`email` like '%dave%' ) > > Keyword: dave thomas > Searches: ( ( `User`.`name` like '%dave%' OR `User`.`email` like '%dave%' ) > AND ( `name` like '% thomas%' OR `email` like '% thomas%' ) ) > > Keyword: 341 > Searches: ( `User`.`id` = '341' ) > > I have written a model function that divides the keywords into an array and > creates an array of conditions that I pass to the find() command. This works > great. > > However this feels like a very common pattern, and I wonder if I just > reinvented the wheel? Sooner or later I will be asked to add special keyword > handlers such as: > > dave OR thomas > dave AND thomas > "dave thomas" > "dave thomas" OR "david thomas" > > Is there already a cake pattern or helper that exists that I should be > using? If not I may just create one for the good of the community. > -- > View this message in > context:http://n2.nabble.com/Search-engine-like-function--tp2753945p2753945.html > Sent from the CakePHP mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
