[HOWTO] Install Sphinx for A Script Pro

Hi,

Here‘s a small howto on installing Sphinx Search (http://sphinxsearch.com/) and configuring it to work with Adult Script Pro. By using sphinx
you will be able to allow users to search for video on your adult tube site by title, description and tags. The search results will be automatically
ordered by relevance (its almost the same as using mysql MATCH_AGAINST, but faster and it can support even 1.000.000 videos).

You will need ssh root access. The installation itself is quite easy, depending on your distribution:

Ubuntu (tested on Ubuntu 10.10):

sudo apt-get update
sudo apt-get install sphinxsearch

CentOs (tested on 5.4):

yum install sphinx

Configuring sphinx si also straight forward, all you need to do is edit the sphinx configuration file and add:

source videos
{
        type        = mysql
    sql_host    = localhost
    sql_user    = mysql-username
    sql_pass    = mysql-password
    sql_db      = mysql-database
    sql_sock    = /var/lib/mysqld/mysqld.sock (this depends on your server)
    sql_port    = 3306

    sql_query_pre       = SET NAMES utf8
    sql_query           =         SELECT v.video_id, v.title, v.description, v.mobile, v.add_time,          v.rating, v.total_views, v.duration, v.video_id AS video, \ #added in RC4
         GROUP_CONCAT(DISTINCT t.name SEPARATOR ‘ ‘) AS tags         FROM video AS v         LEFT JOIN video_tags AS t ON (t.video_id = v.video_id)         WHERE v.status = 1         GROUP BY v.video_id

        sql_attr_uint           = video #added in RC4
        sql_attr_uint           = mobile
        sql_attr_uint           = total_views
        sql_attr_float          = duration
        sql_attr_float          = rating
        sql_attr_timestamp  = add_time
        sql_attr_multi          = uint categories FROM query; SELECT video_id, cat_id FROM video_category
        sql_query_info          = SELECT video_id, add_date FROM video WHERE video_id=$id
}

index videos
{
    source          = videos
    path            = /var/lib/sphinxsearch/data/videos (this depends on your distribution)
        charset_type    = utf-8
        min_prefix_len  = 3
        enable_star     = 1
}

searchd
{
        port            = 3312
        log                     = /var/log/sphinxsearch/searchd.log (this depends on your distribution)
        query_log       = /var/log/sphinxsearch/query.log (this depends on your distribution)
        pid_file        = /var/log/sphinxsearch/searchd.pid (this depends on your distribution)
}

The sphinx data and log folders might depend on your distribution.

After this you need to create the initial index with the following command:

indexer --all --config /path/to/your/sphinx/configuration/file.conf

You will also need to create a cron file and place it into the /etc/cron.hourly (or add it to cron from cpanel or console). The script
should be named sphinx and chmoded to 755, with the following contents:

#!/bin/bash
/usr/bin/indexer --all --rotate --config /path/to/your/sphinx/configuration/file.conf

Thats it :-)

If you dont have the time do the installation yourself, or you dont like the linux console, just drop us a email and we can do the installation
for 49$.

source videos
{
        type        = mysql
    sql_host    = localhost
    sql_user    = mysql-username
    sql_pass    = mysql-password
    sql_db      = mysql-database
    sql_sock    = /var/lib/mysqld/mysqld.sock (this depends on your server)
    sql_port    = 3306

    sql_query_pre       = SET NAMES utf8
    sql_query           =         SELECT v.video_id, v.title, v.description, v.mobile, v.add_time,          v.rating, v.total_views, v.duration,          GROUP_CONCAT(DISTINCT t.name SEPARATOR ‘ ‘) AS tags         FROM video AS v         LEFT JOIN video_tags AS t ON (t.video_id = v.video_id)         AND v.status = 1         GROUP BY v.video_id

        sql_attr_uint           = mobile
        sql_attr_uint           = total_views
        sql_attr_float          = duration
        sql_attr_float          = rating
        sql_attr_timestamp  = add_time
        sql_attr_multi          = uint categories FROM query; SELECT video_id, cat_id FROM video_category
        sql_query_info          = SELECT video_id, add_date FROM video WHERE video_id=$id
}

index videos
{
    source          = videos
    path            = /var/lib/sphinxsearch/data/videos (this depends on your distribution)
        charset_type    = utf-8
        min_prefix_len  = 3
        enable_star     = 1
}

searchd
{
        port            = 3312
        log                     = /var/log/sphinxsearch/searchd.log (this depends on your distribution)
        query_log       = /var/log/sphinxsearch/query.log (this depends on your distribution)
        pid_file        = /var/log/sphinxsearch/searchd.pid (this depends on your distribution)
}
时间: 2024-08-03 14:26:11

[HOWTO] Install Sphinx for A Script Pro的相关文章

HOWTO install Oracle 11g on Ubuntu Linux 12.04 (Precise Pangolin) 64bits

安装了Ubuntu 12.04 64bit, 想在上面安装Oracle 11gr2,网上找了好多文档都没成功,最后完全参考了MordicusEtCubitus的文章. 成功安装的关键点:install additional packages, 在link过程中处理错误的方法. 原文:http://www.makina-corpus.org/blog/howto-install-oracle-11g-ubuntu-linux-1204-precise-pangolin-64bits Before

A Script Pro nginx URL重写规则无法播放MP4解决方法

I am using nginx and I have already add the line location /file/ { rewrite ^/file/([0-9]+)/([0-9]+)/([^/]*)/([0-9]+)/(.*)$ /file.php?id=$1&server=$2&hash=$3&expire=$4&file=$5 last; } in the conf file of the domain. But the videos do not pl

HowTo: Install the IBM Notes 9.0 client on Ubuntu

IBM Notes (formerly Lotus Notes) is a corporate email and database collaboration tool. It's still popular and widely used, and at the time of writing is now up to version 9.0. Unfortunately IBM have a bad habit of assuming no-one uses 64-bit operatin

Bash+R: howto pass parameters from bash script to R(转)

From original post @ http://analyticsblog.mecglobal.it/analytics-tools/bashr/ In the world of data analysis, the term automation runs hand in hand with the term “scripting”. There’s not the best programming language, only the most suitable to perform

HOWTO Install the MinGW (GCC) Compiler Suite

Posted July 25th, 2008 by mingwadmin getting started install mingw Automated Installer If you are new to MinGW, see the MinGW Getting Started instructions to use the automated GUI or manual CLI (Command Line Interface) installers. What follows below

NotePad++ - 安装和配置C/C++开发插件 | NotePad++ - Install and Configure plugins for develop C/C++

一.NotePad++插件 / NotePad++ Plugins 1.Function List ( Unicode ) 当前最新版本:Version 2.1发布日期:2010-02-18安装程序下载地址:http://sourceforge.net/projects/npp-plugins/files/Function%20List/FunctionList%20Plugin%20v2.1/FunctionList_2_1_UNI_dll.zip/download 2.NppExec ( U

How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS

UPDATE 7/7/13: If you want to use Catalyst drivers version 12.8 you will find that X won’t start (error msg: /usr/lib/xorg/modules/drivers/fglrx_drv.so: undefined symbol: noXFree86DRIExtension) if you installed CentOS 6.4. Catalyst > 12.8 will work f

用 Sphinx 搭建博客时,如何自定义插件?

之前有不少同学看过我的个人博客(http://python-online.cn),也根据我写的教程完成了自己个人站点的搭建. 点此:使用 Python 30分钟 教你快速搭建一个博客 为防有的同学不清楚 Sphinx ,这里还是做下简单的介绍. 它是一个能够把一组 reStructuredText 或者 Markdown 格式的文件转换成各种输出格式,而且自动地生成交叉引用,生成目录等的一个文档编排工具. 不得不说,它的排版功能强大.非常清晰,顔值非常高. 但是使用这个方法搭建的博客,一直有一个

使用sphinx创建和查看文档

1. 安装pip $ sudo apt-get install python-pip 2. 安装全文本浏览器lynx $ sudo apt-get install lynx 3. 使用pip安装sphinx $ pip install sphinx 4. sphinx-quickstart可以快速新建一个新的文档记录 $ sphinx-quickstart 5. 对于某些从网上下载的文档源码,只需要找到conf.py所在的目录,比如source,在里面使用如下的命令即可. $ sphinx-bu