Using mnoGoSearch as an embedded search library


Starting with the version 3.0.7, mnoGoSearch is distributed with C API library libmnogosearch making it possible to embed search functionality into your own applications. mnoGoSearch libraries and header files are installed in the /lib and /include directories of the mnoGoSearch installation. Every C source file of your application that uses libmnogosearch functions should include the udmsearch.h header file.

mnoGoSearch API

The detailed description of the mnoGoSearch C API is given in Reference II, mnoGoSearch C API function reference. You can also use search.c as an examples of an application using libmnogosearch functions calls.

The udm-config script

libmnogosearch may require some dependency libraries, for example libmysqlclient. You can find the udm-config script in the /bin directory of your mnoGoSearch installation. This script helps to take the dependencies into account.

udm-config understands a number command line options. By default udm-config prints the list of all available options:

Usage: ./udm-config [OPTIONS]

When executed with the option --libs udm-config outputs all linker flags needed for libmnogosearch dependencies, for example:

# ./udm-config --libs
-lm -L/usr/local/mysql/lib/mysql -lmysqlclient \
-L/usr/local/mnogosearch/lib -lmnogosearch

So you can insert udm-config --libs into the CC compiler command line:

cc myprog.c -o myprog `udm-config --libs`