libudmsearch usage
==================

General information
-------------------
Since version 3.0.7 libudmsearch is available to
use it in third party applications. You can easily
add search into your own application using library
and include files installed in  /lib and /include
UdmSearch directories. Each application which uses 
libudmsearch must have "udmsearch.h" header file
included.


udm-config script
-----------------
When compiled with one of supported SQL backend, 
libudmsearch requires some dependant libraries, 
for example libmysqlclient. You can find "udm-config"
script in /bin directory of UdmSearch installation. 
This script helps to take in account required dependancies.
udm-config script can take several options in it's command 
line. By default udm-config outputs all available options:

Usage: ./udm-config [OPTIONS]
Options:
        [--version]
        [--libs]
        [--cflags]

When executed with --libs command line option udm-config
outputs all required to UdmSearch linker flags, for example:

# ./udm-config --libs
-lm -L/usr/local/mysql/lib/mysql -lmysqlclient \
-L/usr/local/udmsearch/lib -ludmsearch

So you may insert `udm-config --libs` into CC compiler command line:

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



UdmSearch API
-------------

There is no detailed description of UdmSearch API yet. This
is because API is currently under rapid development and may 
have major changes from version to version. You may use search.c 
as an example of application which uses libudmsearch library.
Main function required for successful libudmsearch usage:


int UdmInit();
This function requires to be called before any other UdmSearch 
actions.


int UdmSetDBAddr(char * DBStr); 
Function is used to configure database parameters. Example:

	UdmSetDBAddr("mysql://foo:bar@local/udmsearch/");


void * UdmAllocDB(int mode);
Allocates one database instance. Argument "mode" must have 
UDM_OPEN_MODE_READ value for search purposes.


UDM_DOCUMENT * UdmFind(
	void * db,
	char * search_string
	int  page_number,
	int  page_size,
	int  search_mode,
	int  sort_order,
	char * wordinfo,
	int  * found
);

Performs search. "db" argument is a database instance previously 
allocated by UdmAllocDB() function. "search_string" is the string 
with search query which may contain one or several words.
"search_mode" argument must be UDM_MOD_ALL (all words) or 
UDM_MOD_ANY (any word). "sort_order" argument is not currently
used. "wordinfo" is the pointer to string which will be filled
by found words information. String must have enough space. "found"
argument will be filled by the number of found documents. UdmFind
returns a pointer to UDM_DOCUMENT structures array followed by the NULL
value.


void UdmFreeDB(void * db);
Deletes database instance passed in argument.


int UdmDBErrorCode(void * db);
Does return an error code or 0 on success.


char * UdmDBErrorMsg(void * db);
Does return error description when UdmDBErrorCode()>0
