Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Sphinx Search Beginner's Guide

You're reading from  Sphinx Search Beginner's Guide

Product type Book
Published in Mar 2011
Publisher
ISBN-13 9781849512541
Pages 244 pages
Edition 1st Edition
Languages
Author (1):
Abbas Ali Abbas Ali
Profile icon Abbas Ali

Table of Contents (15) Chapters

Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
1. www.PacktPub.com
2. Preface
1. Setting Up Sphinx 2. Getting Started 3. Indexing 4. Searching 5. Feed Search 6. Property Search 7. Sphinx Configuration 8. What Next?

Time for action - installation on Linux


  1. 1. Download the latest stable version of the sphinx source from http://sphinxsearch.com/downloads.html.

  2. 2. Extract it anywhere on your file system and go inside the extracted sphinx directory:

    $ tar -xzvf sphinx-0.9.9.tar.gz
    $ cd sphinx-0.9.9
  3. 3. Run the configure utility:

    $ ./configure --prefix=/usr/local/sphinx
  4. 4. Build from the source:

    $ make

    Note

    It will take a while after you run the make command as it builds the binaries from the source code.

  5. 5. Install the application (run as root):

    $ make install

What just happened?

We downloaded the latest release of Sphinx and extracted it using the tar command. We then ran the configure command which gets the details of our machine and also checks for all dependencies. If any of the dependency is missing, it will throw an error. We will take a look at possible dependency issues in a while.

Once we are done with configure, the make command will build (compile) the source code. After that, make install will actually install the binaries to respective location as specified in --prefix option to the configure.

Options to the configure command

There are many options that can be passed to the configure command but we will take a look at a few important ones:

  • --prefix=/path: This option specifies the path to install the sphinx binaries. In this book it is assumed that sphinx was configured with --prefix=/usr/local/sphinx so it is recommended that you configure your path with the same prefix.

  • --with-mysql=/path: Sphinx needs to know where to find MySQL's include and library files. It auto-detects this most of the time but if for any reason it fails, you can supply the path here.

  • --with-pgsql=/path: Same as -with-mysql but for PostgreSQL.

Most of the common errors you would find while configuring sphinx are related to missing MySQL include files.

This can be caused either because Sphinx's auto detection for MySQL include path failed, or MySQL's devel package has not been installed on your machine. If MySQL's devel package is not installed, you can install it using the Software Package Manager (apt or yum) of your operating system. In case of Ubuntu, the package is called libmysqlclient16-dev.

Note

If you intend to use Sphinx without MySQL then you can use the configure option --without-mysql.

You need to follow pretty much the same steps if PostgreSQL include files are missing. In this book we will be primarily using MySQL for all examples.

Known issues during installation

Listed next are a few errors or issues that may arise during Sphinx's installation make can sometimes fail with the following error:

/bin/sh: g++: command not found
make[1]: *** [libsphinx_a-sphinx.o] Error 127

This may be because of a missing gcc-c++ package. Try installing it.

At times you might get compile-time errors like:

sphinx.cpp:67: error: invalid application of `sizeof' to
incomplete type `Private::SizeError<false>'

To fix the above error try editing sphinx.h and replace off_t with DWORD in a typedef for SphOffset_t.

#define STDOUT_FILENO fileno(stdout)
#else
typedef DWORD SphOffset_t;
#endif

One drawback of doing this would be that you won't be able to use full-text indexes larger than 2 GB.

Sphinx on Windows

Installing on a Windows system is easier than on a Linux system as you can use the pre-compiled binaries.

You have been reading a chapter from
Sphinx Search Beginner's Guide
Published in: Mar 2011 Publisher: ISBN-13: 9781849512541
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}