• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using MATCH AGAINST in datamapper with select_func()

I am having a bad time trying to get a full text search to work in datamapper.
From much googling and studying the documentation etc I have come up with the following code:

$search = new Plant();          
            $search->select_func('MATCH("@genus","@species","@common_name") AGAINST ("'.$value.'")','relevance');
            $search->where('MATCH("@genus","@species","@common_name") AGAINST ("'.$value.'")');
            $search->having('relevance > 0.2');
            $s = $search->get();

this gives the error:

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"@genus","@species","@common_name") AGAINST ("daisy")() AS relevance FROM (`plan' at line 1

SELECT MATCH("@genus","@species","@common_name") AGAINST ("daisy")() AS relevance FROM (`plants`) WHERE MATCH("@genus","@species","@common_name") AGAINST ("daisy") HAVING `relevance` > 0.2 ORDER BY `relevance` desc

Filename: C:\[my dev server]\system\database\DB_driver.php

Line Number: 330

particularly puzzling is the '()' after ("daisy") - where does that come from?

can anyone shed any light on this?

Messages In This Thread
Using MATCH AGAINST in datamapper with select_func() - by El Forum - 09-24-2012, 10:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.