News Flash:
New Version of ShopClass theme 1.4.0 is Released on 13 JUNE 2018, Please upgrade your installation.

[Tutorial]Sphinx Search Integration in Tuffclassified Theme(Not Needed for new Version)

Use this forum if you need help installing and/or setting up your instance of Tuffclassified theme. This is not the place for customization requests.
User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

[Tutorial]Sphinx Search Integration in Tuffclassified Theme(Not Needed for new Version)

Post by tuffadmin » Mon May 04, 2015 8:19 am

Please follow these instruction on your responsibility, Although I have made sure that these steps are working properly but human error may occur. I may not be responsible for any damage.
What is sphinx server?
Sphinx is an open source full text search server, designed from the ground up with performance, relevance (aka search quality), and integration simplicity in mind. It's written in C++ and works on Linux (RedHat, Ubuntu, etc), Windows, MacOS, Solaris, FreeBSD, and a few other systems.

Sphinx lets you either batch index and search data stored in an SQL database, NoSQL storage, or just files quickly and easily — or index and search data on the fly, working with Sphinx pretty much as with a database server.

Why you should need to use sphinx server?
It is faster, scaleable, more accurate.
Biggest known Sphinx cluster indexes 25+ billion documents, resulting in over 9TB of data. Busiest known one is Craigslist, serving 300+ million search queries/day.

Does tuffclassified theme support all sphinx features?
No, our theme does not support all sphinx feature. In future we will extend our sphinx support to include more features.

How much faster sphinx server is with osclass current mysql search?
On our own classified portal(tuffclassified.com) in busy day with our large database set Sphinx can show search result in milliseconds what osclass do in 10-15 seconds.

To install sphinx search server in ubuntu you need to run this command
sudo apt-get install sphinxsearch
For CentOS check this link which is better explained.
http://briansnelson.com/How_to_install_ ... tos_Server


Before Continuing Make sure you have followed these requirement.
1. You have vps/dedicated server.
2. You have installed sphinx search server in your VPS/Dedicated Server.
3. You have installed latest tuffclassified theme.
Read Next post for Installation Steps.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: Sphinx Search Integration in Tuffclassified Theme

Post by tuffadmin » Mon May 04, 2015 9:17 am

Please follow these instruction on your responsibility, Although I have made sure that these steps are working properly but human error may occur. I may not be responsible for any damage.

1. add this line in your tuffclassified functions.php file
// Include Sphinx Search Functions
require_once 'includes/tfcsphinxsearch.php';


Before this line
// Include custom form model

2. Place attached sphinxapi.php file in your osclass installation directory and add this in oc-load.php file
require_once('sphinxapi.php');

After this line
define('OSCLASS_VERSION', '3.x.x');

3. Now add this code before anything in search.php file which you can find in tuffclassified directory
<?php
$query = Params::getParam('sPattern');
if($query){ osc_current_web_theme_path('search_sphinx.php'); } else {
osc_current_web_theme_path('head.php') ; ?>


and this code after everything
<?php }?>

4. Run below query through phpMyAdmin after selecting your osclass database to create table to save counter in sphinx

Code: Select all

CREATE TABLE IF NOT EXISTS `sph_counter` (
  `counter_id` int(11) NOT NULL,
  `max_doc_id` int(11) NOT NULL,
  PRIMARY KEY (`counter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

You can also manually create this table with running this query. If you know how?

5. Now open attached sphinx.conf file and open it, fill desired information from your default sphinx.conf file normally located in /etc/sphinxsearch or /etc/sphinx and from osclass config.php file

6. Place attached your tfcstopwords.txt file in your desired location but make sure you enter the right path in sphinx.conf file

7 Last step is to add cron job for refreshing your sphinx server index.
These are cron-job which you can add in your linux OS. For ubuntu you need to run command crontab -e for other OS search in Google
0 0 * * * /usr/bin/indexer --rotate tfc_item_desc
*/5 * * * * /usr/bin/indexer --rotate tfc_delta




NOTE: It is possible that attached sphinxapi.php file may not compatible with your installed sphinx server, than you can use google to find compatible sphinxapi.php file with your installed sphinx version.
You do not have the required permissions to view the files attached to this post.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

steve
Senior
Posts: 222
Joined: Thu Oct 01, 2015 5:33 pm
Has thanked: 11 times
Been thanked: 4 times

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by steve » Mon Oct 12, 2015 3:37 pm

Hellow Navjot,
Will these instructions work for Spanish language too? As i saw in the file named tfcstopwords.txt that all the text written inside is in English language.
Thanks

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by tuffadmin » Tue Oct 13, 2015 7:14 am

I have not tested but you can try.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

fr4nk
Senior
Posts: 67
Joined: Wed Jul 23, 2014 4:40 pm
Has thanked: 8 times
Been thanked: 1 time
Contact:

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by fr4nk » Thu Oct 15, 2015 4:59 pm

Hi. Would it be possible to set it so it will search just cities and regions please ?

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by tuffadmin » Fri Oct 16, 2015 6:22 am

Although It can do mysql like filtering but it is not recommended. What is your use case?
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

fr4nk
Senior
Posts: 67
Joined: Wed Jul 23, 2014 4:40 pm
Has thanked: 8 times
Been thanked: 1 time
Contact:

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by fr4nk » Fri Oct 16, 2015 6:25 pm

my site is only about one service so people only searching for locations and nothing else.

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by tuffadmin » Sat Oct 17, 2015 10:48 am

fr4nk wrote:my site is only about one service so people only searching for locations and nothing else.
It can be done with new version but not for now. As current tuffclassified is using old apis and I have implemented new apis in new version. You can do that when it will be available.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

steve
Senior
Posts: 222
Joined: Thu Oct 01, 2015 5:33 pm
Has thanked: 11 times
Been thanked: 4 times

Re: Sphinx Search Integration in Tuffclassified Theme

Post by steve » Tue Oct 20, 2015 3:30 pm

tuffadmin wrote:Please follow these instruction on your responsibility, Although I have made sure that these steps are working properly but human error may occur. I may not be responsible for any damage.
Hello Navjot,
I installed sphinx, which was succcesful on my Centos server in Digitalocean. But when i start my service by using " service searchd start " i get this message --

Code: Select all

[[email protected] ~]# service searchd start
Starting searchd: Sphinx 2.0.8-id64-release (r3831)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
WARNING: compat_sphinxql_magics=1 is deprecated; please update your application
and config
listening on 127.0.0.1:9312
listening on all interfaces, port=9306
precaching index 'test1'
WARNING: index 'test1': preload: failed to open /var/lib/sphinx/test1.sph: No su
ch file or directory; NOT SERVING
precaching index 'testrt'
precached 2 indexes in 0.001 sec
The sphinx.conf file has too many things that i don't understand, i'd appreciate if you could make a small tutorial for it.I've put in my mysql connection values, but the rest of the things are too many to ask...

Thanks.

User avatar
tuffadmin
Site Admin
Posts: 1236
Joined: Tue Jan 29, 2013 7:31 pm
Has thanked: 33 times
Been thanked: 111 times

Re: [Tutorial]Sphinx Search Integration in Tuffclassified Th

Post by tuffadmin » Wed Oct 21, 2015 6:45 pm

I can setup your sphinx server if this tutorial seems difficult. But here is festive season in India so I will not be available for 2-3 days.
No support for unnecessary PM, use forum for support queries.
Please give us good review if you bought our theme from Osclass Market

Locked