0
votes

I am trying to do a MATCH on 2 tables with a LEFT JOIN

`jos_application_listing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `headline` text NOT NULL,
  `city` bigint(20) NOT NULL,
  `state` varchar(500) NOT NULL,
  `country` varchar(500) NOT NULL,
  `features` text NOT NULL,
  `listing_type` bigint(20) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `website` varchar(1000) NOT NULL,
  `pictures` mediumtext,
  `address` varchar(100) NOT NULL DEFAULT '',
  `postal` varchar(25) NOT NULL DEFAULT '',
  `category` bigint(20) NOT NULL,
  `sub_category` bigint(20) NOT NULL,
  `latitude` float NOT NULL,
  `longitude` float NOT NULL,
  `listing_expire` varchar(255) NOT NULL DEFAULT 'normal',
  `featured_till` datetime NOT NULL,
  `facebook` text NOT NULL,
  `video` text NOT NULL,
  `video_size` text NOT NULL,
  `business_hours` text NOT NULL,
  `published` tinyint(4) NOT NULL,
  `featured` tinyint(4) NOT NULL,
  `UID` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

`jos_application_cities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `city` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8;

INDEX -> > >

I Have an FULL TEXT index on jos_application_listing (name, headline, description)

AND

I Have an FULL TEXT index on jos_application_cities (city)

QUERY -> > >

SELECT * FROM jos_lnzon_listing 
LEFT JOIN jos_lnzon_cities ON jos_lnzon_listing.city = jos_lnzon_cities.id
WHERE MATCH (name,headline,description,jos_lnzon_listing.city)
AGAINST ('" . $searchQuery . "' IN BOOLEAN MODE)";

I can not see the issue, but I am getting the following error :

1271 - Illegal mix of collations for operation 'match' SQL=SELECT * FROM jos_lnzon_listing LEFT JOIN jos_lnzon_cities ON jos_lnzon_listing.city = jos_lnzon_cities.id WHERE MATCH (name,headline,description,jos_lnzon_listing.city) AGAINST ('+search term' IN BOOLEAN MODE)

1
You only use 2 underscores after the table prefix is when you use the hashtag as the global prefix. For example #__lnzon_listing, which is the recommended method for queries. If you manually define the prefix (not recommended), then it only requires 1 underscore like so, jos_lnzon_listingLodder
Hi Sorry Typo, fixing - I do use #__lnzon_listing in Joomla, but just for the purpose of reading in the question I used jos_MaxD

1 Answers

1
votes

My experience of collation errors has usually been as a result of character encoding mismatches - have you tried explicitly setting your connection character set to UTF-8?

http://php.net/manual/en/mysqli.set-charset.php

I do not know how easy that is to do within Joomla, I am afraid :(.

You can also check the collation of the columns to see that they are, indeed, all UTF-8: https://stackoverflow.com/a/10014869/994291.