Professional Documents
Culture Documents
Configure Sphinx Full Text Search Engine - TrinityTuts - Medium PDF
Configure Sphinx Full Text Search Engine - TrinityTuts - Medium PDF
2020 Conf gure Sph nx Full text search eng ne - Tr n tyTuts - Med um
Sphinx is open source search engine. Sphinx allow full-text searches. Sphinx is very
efficient to perform search over large data. Sphinx can index data from various
different sources like: MySQL, HTML, Text Files etc.
Step 2. Create database on your MySql server and run below query.
--
-- Database: `sphinx_demo`
--
CREATE DATABASE IF NOT EXISTS `sphinx_demo` DEFAULT CHARACTER SET
latin1 COLLATE latin1_swedish_ci;
USE `sphinx_demo`;
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
--
-- Dumping data for table `products`
--
--
-- Indexes for dumped tables
--
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
Step 3. Update Sphinx configuration run below code and update configuration
sql_query = \
SELECT id, design_no, album_id, product, fabric, stock,
UNIX_TIMESTAMP(created) AS date_added \
FROM products
sql_attr_uint = id
sql_field_string = design_no
sql_field_string = album_id
sql_field_string = product
sql_field_string = fabric
sql_field_string = stock
sql_attr_timestamp = date_added
}
index test1
{
source = src1
path = /var/lib/sphinxsearch/data/test1
docinfo = extern
}
searchd
{
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinxsearch/searchd.pid
https://med um.com/tr n tytuts/conf gure-sph nx-full-text-search-eng ne-d6a3e2c8158f 4/6
26.02.2020 Conf gure Sph nx Full text search eng ne - Tr n tyTuts - Med um
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
binlog_path = /var/lib/sphinxsearch/data
}
// Run query
SELECT * FROM test1 WHERE MATCH('saree'); SHOW META;
Output:-
You can read complete information about setting up Sphinx Server here