#
# it is assumed that dictd is run with '--pp m4'
#
# Run 'm4 examples/dictd_complex.conf' to see how this
#   configuration file will be expanded by m4
#

#########################################################
#
# Simple macroses to define a simple database entry
#

define(db_simple_2arg,`
database $1 {
  data   $2.dict.dz
  `index'  $2.`index'
}')

define(db_simple, db_simple_2arg($1, $1))

db_simple(gcide)
db_simple_2arg(gaz, gazetteer)



#########################################################
#
# More complex macros implementing a combination of
# standard databases, virtual dictionaries and plugins.
#

define(db3,`

database $1_standard {
  `index' $2.`index'
  data  $2.dict.dz

  # In order not to make "exact" and "lev" search twice
  # we disable these strategies here.
  disable_strategy exact
  disable_strategy lev

  # top level virtual "dictionary" implementing all strategies is visible
  invisible
}

database_plugin $1_fast_exact {
  plugin "dictdplugin_judy.so"

  data "\
    allchars = 0\n\
    utf8     = $3\n\
    `index'    = $2.`index'\n\
    data     = $2.dict.dz\n\
  "

  # We want judy-based plugin implement "exact" and "lev" strategies only.
  # "prefix" strategy is also provided by Judy plugin,
  # but for short query it may work even slower than standard databases.
  # Therefore we disable it too.
  disable_strategy "prefix"

  # All others strategies are not provided by Judy plugin,
  # but we disable them explicitly. At least this saves one function call ;-)
  disable_strategy "substring"
  disable_strategy "suffix"
  disable_strategy "re"
  disable_strategy "regexp"
  disable_strategy "soundex"
  disable_strategy "word"

  # top level virtual "dictionary" implementing all strategies is visible
  invisible
}

database_virtual $1 {
  # virtual database implements
  # fast "exact" and "lev"  search strategies
  # using Judy-based plugin
  # and standard algorithms for all other strategies.

  name   "@00-database-short"
  info   "@00-database-info"

  database_list "$1_fast_exact,$1_standard"
}')

define(db_invis,  `db_invis3($1, $1, 1)')
define(db, `db3($1, $1, 1)')

db(vera)
db(wn)
db(hitchcock)
db(easton)
db(elements)
db(jargon)
