Sphinx Full-text Search Engine for Zen Cart and osCommerce
Sphinx Full-text Search Engine for Zen Cart & osCommerce
1, Download Sphinx from http://www.sphinxsearch.com/downloads.html
cd /home/sphinx/
wget http://www.sphinxsearch.com/downloads/sphinx-1.0.tar.gz
2, Extract gz file
gunzip sphinx-1.0.tar.gz
tar xvf sphinx-1.0.tar
3, Install sphinx
cd sphinx/sphinx-1.0
./configure –prefix=/home/sphinx/sphinxsearch
make
make install
4, Create config file
cd home/sphinx/sphinxsearch/etc
cp sphinx.conf.dist sphinx.conf
edit sphinx.conf
source labsupply
{
type = mysql
sql_host = localhost
sql_user = me
sql_pass = myself
sql_db = mydb
sql_port = 3306 # optional, default is 3306
# SELECT id, grant_id, parent_id, pi_name, project_title, keywords FROM grants
sql_query = \
select a.products_id, a.products_model, a.gi_number , a.manufacturer_name,\
b.products_name , a.keywords, a.host, a.gene_name, a.gene_symbol , a.gene_name_synonyms,\
a.swiss_prot_acc, a.synonyms, a.antigen_name, a.antigen_synonym, a. description,\
a. relevance, b.products_description from products a, products_description b \
where a.products_id =b.products_id \
and a.products_status=1 and a.products_quantity !=0
sql_query_info = SELECT * FROM products WHERE products_id =$id
}
index labsupply_indx
{
source = labsupply
path = /home/sphinx/sphinxsearch/var/data/labsupply
docinfo = extern
mlock = 0
min_word_len = 3
charset_type = sbcs
min_prefix_len = 0
min_infix_len = 3
html_strip = 0
}
indexer
{
mem_limit = 256M
}
searchd
{
port = 3312
log = /home/sphinx/sphinxsearch/var/log/searchd.log
query_log = /home/sphinx/sphinxsearch/var/log/query.log
read_timeout = 5
max_children = 30
pid_file = /home/sphinx/sphinxsearch/var/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
}
5, Build Index
/home/sphinx/sphinxsearch/bin/indexer –config /home/sphinx/sphinxsearch/etc/sphinx.conf –all
ls -la /home/sphinx/sphinxsearch/var/data
6, Do a search test
/home/sphinx/sphinxsearch/bin/search –config /home/sphinx/sphinxsearch/etc/sphinx.conf akt
….
words:
1. ‘akt’: 456 documents, 2016 hits