DROP FUNCTION IF EXISTS strip_tags; DELIMITER $$$ CREATE FUNCTION strip_tags( x text) RETURNS text LANGUAGE SQL NOT DETERMINISTIC READS SQL DATA BEGIN DECLARE sstart INT UNSIGNED; DECLARE ends INT UNSIGNED; SET x = CONCAT('
', x, '
'); SET sstart = LOCATE('<', x, 1); REPEAT SET ends = LOCATE('>', x, sstart); SET x = CONCAT(SUBSTRING( x, 1 ,sstart -1), SUBSTRING(x, ends +1 )) ; SET sstart = LOCATE('<', x, 1); UNTIL sstart < 1 END REPEAT; return x; END $$$ DELIMITER ; -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Content_', 'Search Content Block', 360); ALTER TABLE `bs_zz_HtmlBlockContent` ADD `searchContent` TEXT NOT NULL AFTER `content`; ALTER TABLE `bs_zz_DraftHtmlBlockContent` ADD `searchContent` TEXT NOT NULL AFTER `content`; UPDATE `bs_zz_HtmlBlockContent` SET `searchContent` = strip_tags(`content`); UPDATE `bs_zz_DraftHtmlBlockContent` SET `searchContent` = strip_tags(`content`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Empty_', 'Empty Search Result', 370); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_News_', 'Search Associations', 380); ALTER TABLE `bs_News` ADD `searchContent` TEXT NOT NULL AFTER `content`; UPDATE `bs_News` SET `searchContent` = strip_tags(`content`); -- -- ALTER TABLE `bs_History` ADD `searchContent` TEXT NOT NULL AFTER `description`; UPDATE `bs_History` SET `searchContent` = strip_tags(`description`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Faq_', 'Search FAQ', 390); ALTER TABLE `bs_Faq` ADD `searchContent` TEXT NOT NULL AFTER `answer`; UPDATE `bs_Faq` SET `searchContent` = strip_tags(`answer`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_People_', 'Search Our Team', 400); ALTER TABLE `bs_People` ADD `searchContent` TEXT NOT NULL AFTER `fullBio`; UPDATE `bs_People` SET `searchContent` = strip_tags(`fullBio`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Work_', 'Search Portfolio', 410); ALTER TABLE `bs_Work` ADD `searchContent` TEXT NOT NULL AFTER `content`; UPDATE `bs_Work` SET `searchContent` = strip_tags(`content`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Product_', 'Search Product', 420); ALTER TABLE `bs_Product` ADD `searchContent` TEXT NOT NULL AFTER `description`; UPDATE `bs_Product` SET `searchContent` = strip_tags(`description`); -- -- INSERT INTO `bs_zz_DPageItemType` (`type`, `title`, `sorter`) VALUES ('Search_Form_', 'Search Form', 450); -- -- DROP FUNCTION IF EXISTS strip_tags;