Next: , Previous: , Up: Standard Commands   [Contents][Index]


B.2.2 The MATCH Command

The MATCH command searches for word in the database index. The searching algorithm is determined by strategy. See Strategies, for a list of strategies offered by GNU Dico.

Command: MATCH database strategy word

Match word in database using strategy. As with DEFINE, the database can be ‘!’ or ‘*’ (See The DEFINE Command, for a detailed description of these wildcards).

The strategy is either the name of a strategy to use, or a dot (‘.’), meaning to use default strategy. The default strategy is set using default-strategy configuration file statement (see default-strategy. Its default value is ‘lev’, which means ‘use Levenshtein algorithm’ (see Strategies).

If no matches are found in any of the searched databases, then response code 552 will be returned. Otherwise, response code 152 will be returned followed by a list of matched words, one per line, in the form:

database word

Thus, prepending a ‘DEFINE ’ to each such response, one obtains a valid DEFINE command.

The textual body of the match list is terminated with a line containing only a dot character.

Following the list, response code 250 is sent, which includes timing information, if timing directive is set in the configuration file (see Tuning).

Possible responses:

550 Invalid database, use SHOW DB for a list
551 Invalid strategy, use SHOW STRAT for a list
552 No match
152 n matches found: list follows
250 ok (optional timing information here)

Examples:

C: MATCH * . "weather"
S: 152 12 matches found: list follows
C: eng-afr "feather"
C: eng-afr "leather"
C: eng-afr "weather"
C: eng-deu "feather"
C: eng-deu "heather"
C: eng-deu "leather"
C: eng-deu "weather"
C: eng-deu "wether"
C: eng-deu "wheather"
C: devils "WEATHER"
S: .
S: 250 Command complete [d/m/c = 0/12/100677 0.489r 0.479u 0.007s]

Next: The SHOW Command, Previous: The DEFINE Command, Up: Standard Commands   [Contents][Index]