Wednesday, 4 July 2012

SPHINX SEARCH ENGINE USAGE



On Linux: (On command Line)
1. Create a configuration file.
Default configuration file name is sphinx.conf.
All Sphinx programs look for this file in current working directory by default.
Sample configuration file, sphinx.conf.dist, which has all the options
documented, is created by configure. Copy and edit that sample file to
make your own configuration:
(assuming Sphinx is installed into /usr/local/sphinx/).
$ cd  /usr/local/sphinx/etc
$ cp sphinx.conf.dist sphinx.conf
$ vi  sphinx.conf

 
Sample configuration file is setup to index documents table from MySQL
database test; so there's example.sql sample data file to populate that table with a
few documents for testing purposes:
$ mysql -u test < /usr/local/sphinx/etc/example.sql.
2. Run the indexer to create full-text index from your data:
$ cd /usr/local/sphinx/etc
$ /usr/local/sphinx/bin/indexer –all
 
3. Query your newly created index!
To query the index from command line, use search utility:
$ cd /usr/local/sphinx/etc
$ /usr/local/sphinx/bin/search test


On Windows: (On command Line)

Step 1. Configure Sphinx:

    1. Open the extension archive (e.g. SphinxSearch-trunk-r97051.tar.gz) and
    extract sphinx.conf to the Sphinx folder (C:\Sphinx). 

    2. Edit the contents of C:\Sphinx\sphinx.conf. Look for sql_db, sql_user,
    sql_pass, path, log, query_log and pid_file variables.
    Create the paths as necessary. Make sure you use backslashes (\) instead of
    forward slashes (/). 

    3. Don't forget to add a binlog_path = line (that points to a real folder) in the
    searchd to make sure that the service starts successfully in windows

     
    Step 2: Run Sphinx Indexer :

    Running an incremental indexing process in command shell mode
    Run the sphinx indexer to prepare for searching:
            C:\Sphinx\bin\indexer --config C:\Sphinx\sphinx.conf --all
    Once again, make sure to replace the paths to match your installation. This
    process is actually pretty fast, but clearly depends on how large your wiki is.
    Just be patient and watch the screen for updates.



    Step 3: Search:

    Actual search process from Mediawiki displayed in command shell mode
    When the indexer is finished, test that sphinx searching is actually working:
            C:\Sphinx\bin\search --config C:\Sphinx\sphinx.conf "search string"


                                                                                    -PAVANKUMAR JOSHI

No comments:

Post a Comment