Welcome Guest, Not a member yet? Register   Sign In
Using MySQL MATCH is case sensitive
#1

[eluser]Gaz[/eluser]
Hi all,

I'm using the following code to do a FULLTEXT match on some data

Code:
$this->db->where('MATCH (`content`) AGAINST ("'.$search_term.'")', NULL, FALSE);
$this->db->where_in('belongs_to', $object_ids);
$result = $this->db->get('metadata');

Basically, the query string returned from this seems to be case sensitive when run in CI, but case insensitive when run from my MySQL client Sequel Pro.

I.e. The string 'United Kingdom' produces results in CI, but 'united kingdom' does not (although both these strings return the same results in my MySQL client).

The field 'content' I'm searching against is a text field, and the database charset and collation are utf8, utf8_general_ci.

I'm puzzled as to why the same query produces different results, depending on where it's run.

Any light anybody could shed on this would be much appreciated.

Cheers,
Gaz.
#2

[eluser]n0xie[/eluser]
Step 1, show us the query that is build by active record.
Step 2, try the query without active record, and see if this returns the same resultset.




Theme © iAndrew 2016 - Forum software by © MyBB