PHP Classes

File: FILE/searchdb.sql

Recommend this page to a friend!
  Classes of Ettore Moretti   Multisources Search Engine   FILE/searchdb.sql   Download  
File: FILE/searchdb.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Multisources Search Engine
Search data on MySQL, XML, INI or flat files
Author: By
Last change: MultisourcesSearchEngine

The Search class allows you to perform searches on a variety of sources.
Date: 2 years ago
Size: 2,946 bytes
 

Contents

Class file image Download
-- phpMyAdmin SQL Dump -- version 3.5.2.2 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generato il: Ott 23, 2014 alle 22:21 -- Versione del server: 5.5.27 -- Versione PHP: 5.4.7 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `searchdb` -- DELIMITER $$ -- -- Funzioni -- CREATE DEFINER=`root`@`localhost` FUNCTION `levenshtein`( s1 VARCHAR(255), s2 VARCHAR(255) ) RETURNS int(11) DETERMINISTIC BEGIN DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT; DECLARE s1_char CHAR; -- max strlen=255 DECLARE cv0, cv1 VARBINARY(256); SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0; IF s1 = s2 THEN RETURN 0; ELSEIF s1_len = 0 THEN RETURN s2_len; ELSEIF s2_len = 0 THEN RETURN s1_len; ELSE WHILE j <= s2_len DO SET cv1 = CONCAT(cv1, UNHEX(HEX(j))), j = j + 1; END WHILE; WHILE i <= s1_len DO SET s1_char = SUBSTRING(s1, i, 1), c = i, cv0 = UNHEX(HEX(i)), j = 1; WHILE j <= s2_len DO SET c = c + 1; IF s1_char = SUBSTRING(s2, j, 1) THEN SET cost = 0; ELSE SET cost = 1; END IF; SET c_temp = CONV(HEX(SUBSTRING(cv1, j, 1)), 16, 10) + cost; IF c > c_temp THEN SET c = c_temp; END IF; SET c_temp = CONV(HEX(SUBSTRING(cv1, j+1, 1)), 16, 10) + 1; IF c > c_temp THEN SET c = c_temp; END IF; SET cv0 = CONCAT(cv0, UNHEX(HEX(c))), j = j + 1; END WHILE; SET cv1 = cv0, i = i + 1; END WHILE; END IF; RETURN c; END$$ DELIMITER ; -- -------------------------------------------------------- -- -- Struttura della tabella `table1` -- CREATE TABLE IF NOT EXISTS `table1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Searchable` varchar(50) NOT NULL, `Other_Searchable` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dump dei dati per la tabella `table1` -- INSERT INTO `table1` (`id`, `Searchable`, `Other_Searchable`) VALUES (1, 'ettore', ''), (2, 'xara', ''), (3, 'yuppi', ''), (4, 'ciao', ''), (5, 'ettorx', ''), (6, 'ettaro', ''), (7, 'direttore', ''); -- -------------------------------------------------------- -- -- Struttura della tabella `table2` -- CREATE TABLE IF NOT EXISTS `table2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Searchable` varchar(50) NOT NULL, `Other_Searchable` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dump dei dati per la tabella `table2` -- INSERT INTO `table2` (`id`, `Searchable`, `Other_Searchable`) VALUES (1, 'roma', ''), (2, 'milano', ''), (3, 'parma', ''), (4, 'pavia', ''); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;