DBAddr

Name

DBAddr -- sets database address

indexer.conf search.htm

Synopsis

DBAddr {{DBType}:[//[DBUser[:DBPass]@]DBHost[:DBPort]]/DBName/[?DBMode=mode]}

Description

This command defines URL-style database address.

Type, host, database name, port, user and password are options to connect to SQL database.

Must be used before any other commands. Has global effect on the whole configuration file.

ODBC notes: Use DBName to specify ODBC Data Source Name (DSN) DBHost does not matter, so use "localhost".

Currently supported DBType values are mysql, pgsql, mssql, sybase, oracle, ibase, db2, mimer, sqlite, sqlite3, cache.

If you are using PostgreSQL and do not specify hostname, e.g.


pgsql://user:password@/dbname/
mnoGoSearch will communicate with PostgreSQL not via TCP, but using a Unix socket.

MySQL and PostgreSQL users can specify path to Unix socket when connecting to localhost:


DBAddr mysql://foo:bar@localhost/mnogosearch/?socket=/tmp/mysql.sock
DBAddr pgsql://foo:bar@/mnogosearch/?socket=/tmp/s.PGSQL.5432

MySQL users can specify whether to switch MySQL query logging on/off using sqllog parameter:


DBAddr mysql://foo:bar@localhost/mnogosearch/?sqllog=0
DBAddr mysql://foo:bar@localhost/mnogosearch/?sqllog=1
If sqllog parameter is given, then mnoGoSearch will send "SET SQL_LOG_OFF=X" query on connection time.

When initializing connection to MySQL, mnoGoSearch forces loading of my.cnf configuration file with the "client" option group by default. Use MyCnfGroup=group to load options from another group, or MyCnfGroup=no to prevent loading of my.cnf file:


# Load options from another option group
DBAddr mysql://foo:bar@localhost/mnogosearch/?MyCnfGroup=mnogosearch

# Prevent loading my.cnf
DBAddr mysql://foo:bar@localhost/mnogosearch/?MyCnfGroup=no
When connecting to MySQL, mnoGoSearch uses this MySQL C API call to tell the MySQL connection handler which option group to load (unless MyCnfGroup=no is specified):

mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, MyCnfGroup);

The "DBMode" optional patameter value is "single", "multi" or "blob". Default mode is "single".

Some special characters, if they appear as a password part, need to be escaped using %XX notation, where XX is a hex code. Use %3A for ":", %3B for ";", %3C for "<", %3D for "=", %3E for ">", %3F for "?" and %40 for "@" characters. For example,


DBAddr pgsql://user:pwd%3Awith%40special%3Cchars@/search/
corresponds to the local PostgreSQL database "search" with user name "user" and password "pwd:with@special<chars".

Starting with 3.2.36 DBAddr supports Deflate=yes|no parameter. With "Deflate=yes" specified, indexer compresses data when converting with "indexer -Eblob", which makes smaller database size and faster search. This option is effective for DBMode=blob only. There is no need to specify this option in search template, mnogosearch will detect and handle compressed data automatically while searching.


DBAddr mysql://foo:bar@localhost/mnogosearch/?DBMode=blob&Deflate=yes

Starting with 3.2.36 DBAddr supports zint4=yes|no parameter. With "zint4=yes" specified, indexer compresses document IDs using a special compression method which we called "zint4". This compression method is as effective as possible: it compresses data up to 85% with relative good decompression speed. In conjunction with Deflate=yes parameter, compression ratio can be up to 99.8%. This option is effective for DBMode=blob, for '#rec_id' field only.


DBAddr mysql://foo:bar@localhost/mnogosearch/?DBMode=blob&Deflate=yes&zint4=yes

Examples


DBAddr mysql://foo:bar@localhost/mnogosearch/?DBMode=multi
DBAddr mysql://foo:pwd%3Awith%40special%3Cchars@localhost/mnogosearch/