Deliverable 3
My Experiments with Sphinx
Objective: The main objective of this deliverable was to perform experiments with Sphinx. The experiments involved the study of how Sphinx works and also indexing databases using Sphinx.
Description:
Introduction to Sphinx
Sphinx is an open source full text search server, designed from the ground up with performance, relevance, and integration simplicity in mind. It is written in C++ and works on Linux, Windows, MacOS, Solaris, FreeBSD, and a few other systems. Sphinx allows to either batch index and search data stored in an SQL database or just files quickly and easily [1].
Experiments
In this deliverable, two tasks were accomplished using Sphinx. The two tasks were:
- Index and search data from the sample database provided by Sphinx.
- Index and search data from a newly created database.
Firstly, indexing is done on the sample database provided by Sphinx. For this purpose, the following steps are followed.
- Sphinx was downloaded and unzipped into the C:/ drive.
- A data folder was created in the Sphinx folder.
- The configuration file was present in the Sphinx folder.
- All the necessary changes were made in the configuration file to match the path suitable for the system.
- The command prompt was opened.
- Sphinx is installed as a window service using the following command:
C:\Sphinx\bin> C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf.in --searchd1 SphinxSearch
- A sample data file example.sql is provided by Sphinx to populate the documents table with a few documents for testing purposes.
- Documents table is present in the test database.
- Import the example.sql file.
- A full-text index of the data was created by running the indexer.
- Search was done on the keyword test using the search utility in the bin folder.
The experiments done can be seen in the following figures:
Figure1: Importing the database and running the indexer
|
Figure2: Search for keyword using search utility
|
Secondly, a full-text index was created for my own database and a search is done on few keywords. For this purpose, the following steps were followed:
- A new database testSphinx is created using mysql.
- A table named details is created in the database.
- A .sql file is created for the database.
- The sphinx configuration file is changed according to the newly created database.
- The main changes made were changing the sql database, changing the field names in the query and changing the index names.
- A document id field should be the first field in any new database in order to identify the document.
- Indexing is done on the newly created database.
- Search was done with two keywords: details and tanmayee.
The experiments done can be seen in the following figures:
Figure3: Creation of a new database and .sql file
|
Figure4: Details table
|
Figure5: Importing testSphinx database and indexing it
|
Figure6: Search results for the keyword "details"
|
Figure7: Search results for the keyword "details"(cont
)
|
Figure8: Search results for the keyword "tanmayee"
|
References
- Source: http://sphinxsearch.com/ , Retrieved November 21, 2011
|