Full Text Searching

87 views
Skip to first unread message

Sebastian Frohm

unread,
Feb 14, 2013, 12:49:38 PM2/14/13
to pha...@googlegroups.com
Hey guys,

Is there a way to do full text searching within the ORM? I realize I can do it outside of the basic ORM, but I was hoping to find one within, or at least discuss the possibility of it.

I tried this:

$search = $this->request->getPost('search', 'string');

$projects = Projects::find(array(
    'conditions' => 'MATCH(project_name) AGAINST (?1)',
    'bind' => array(
        $search
    )
));

echo '<prE>';
var_dump($project);
exit;

Obviously, that doesn't work. Is there any way we could get something like this:

$projects = Projects::find(array(
    'match' => array(
        'name',
        'body'
    ),
    'against' => array(
        $param1,
        $param2,
    )
));

I obviously don't mean to come off like I'm expecting anything; I think it could be helpful, however. Let me know what you guys think!

Romanko

unread,
Feb 19, 2013, 1:07:44 AM2/19/13
to pha...@googlegroups.com
Try it like this:

$projects = Projects::find(array(
    'conditions' => 'MATCH(project_name) AGAINST (?1)',
    'bind' => array(
        1 => $search
    )
));

I think index following the question mark should much the index within bind parameters array.



Reply all
Reply to author
Forward
0 new messages