0
這裏的CREATE TABLE:爲什麼我不能在我的FULLTEXT索引中匹配()AGAINST()其中一列?
CREATE TABLE `EntityAddresses` (
`EntityAddress_ID` int(11) NOT NULL AUTO_INCREMENT,
`Entity_ID` int(11) NOT NULL,
`CreateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`CreatedBy` int(11) NOT NULL,
`UpdateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`UpdatedBy` int(11) NOT NULL,
`StreetAddress` varchar(150) NOT NULL DEFAULT '',
`StreetAddress2` varchar(150) NOT NULL DEFAULT '',
`City` varchar(50) NOT NULL DEFAULT '',
`State` varchar(50) NOT NULL DEFAULT '',
`PostalCode` varchar(30) NOT NULL DEFAULT '',
`Country` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`EntityAddress_ID`),
KEY `Entity_ID` (`Entity_ID`),
KEY `CreatedBy` (`CreatedBy`),
KEY `UpdatedBy` (`UpdatedBy`),
FULLTEXT INDEX `EntityAddresses_ibft_1` (`StreetAddress`,`StreetAddress2`,`City`,`State`,`PostalCode`,`Country`),
CONSTRAINT `EntityAddresses_ibfk_1` FOREIGN KEY (`Entity_ID`) REFERENCES `Entities` (`Entity_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `EntityAddresses_ibfk_2` FOREIGN KEY (`CreatedBy`) REFERENCES `Users` (`User_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `EntityAddresses_ibfk_3` FOREIGN KEY (`UpdatedBy`) REFERENCES `Users` (`User_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
下面是一個例子紀錄:
EntityAddress_ID: 5908
Entity_ID: 4514
CreateDate: 2015-05-25 13:59:43
CreatedBy: 2
UpdateDate: 2015-05-25 13:59:43
UpdatedBy: 2
StreetAddress: Testing 123
StreetAddress2:
City: Singapore
State:
PostalCode:
Country: SG
這裏是一個要返回上面的例子中記錄的查詢:當我嘗試相同的查詢
SELECT
*
FROM
`EntityAddresses`
WHERE
MATCH (`StreetAddress` , `StreetAddress2` , `City` , `State` , `PostalCode` , `Country`) AGAINST ('+SG' IN BOOLEAN MODE);
用「新加坡」代替「SG」時,它會返回包含上述示例記錄的結果集,但「SG」不返回任何結果。我嘗試了其他國家,我得到了相同的結果,0行。
的值。如果您的記錄50%包含您搜索的文本,然後將它忽略。這是你的情況嗎? –
此外,全文索引中包含的最小字長缺省值爲3. – Marki555
@ Marki555這將是問題所在。你能否提供它作爲參考文獻的答案?我會將其標記爲答案。 – Travis