![]() |
![]()
| ![]() |
![]()
NAMEDtSrAPI — Describes overview, constants, and structures for DtSearch online API DESCRIPTIONThe DtSearch API provides programmatic access to the DtSearch search and retrieval engine. The API functions are located in the library libDtSr, and are directly linked into user written search programs. Search and retrieval of DtSearch databases is available through three essential API functions:
DtSearch MessageListAll functions can potentially return multiple messages on a global linked list of messages called the MessageList. Most unsuccessful return codes append at least one message to the MessageList, but even successful returns may append messages, and multiple messages are always possible. Messages are standard C text strings terminated by a zero byte, and were designed to be displayed directly to users. Several API utility functions are available for manipulating the MessageList. Fatal API ErrorsCertain fatal errors will require an immediate abort from the engine. By default fatal error messages will be written to the stderr, but can be written to a text file specified in DtSearchInit. All API aborts are implemented through a call to DtSearchExit. DtSearchExit() ensures cleanup of a number of system resources before the final call to exit. Developers can add an additional user exit to DtSearchExit to specify additional emergency clean up before process exit. CONSTANTSFunction Return Code ConstantsMost API functions return one of a set of standard integer return codes. The return code DtSrOK means complete success, other return codes indicate various levels of negative results or failure.
Language NumbersEach DtSearch database is associated with an integer representing among other things the natural language of its documents. These constants are used throughout the API to identify the supported languages.
Other General Constants
DtSrObjdate TypeDtSrObjdate is a typdef for an unsigned integer used as a date/time stamp for documents. DtSearch queries may be qualified by document date ranges. The data type packs certain standard struct tm fields into bitmap fields to minimize space. DtSrObjdate are based on the western Gregorian calendar and are not guaranteed to map to other time locales. DtSearch objdates have a range from 1900 to 5995 inclusive and a resolution of 1 minute. From hi order bits to low:
STRUCTURESDtSrKeytype Typetypedef struct { A DtSearch keytype references a logical subset of the database. The primary identifier for a keytype is the keytype character ktchar. The ktchar identifies the subset of the database that has that character as the first character of its document keys. The DtSrKeytype structure associates the ktchar with a short name string for use in user GUI labels identifying the keytype, and provides a boolean selection toggle for the keytype. An array of DtSrKeytype structures is maintained by the API for each database after API initialization. The API function DgSearchGetKeytypes() is used to access the array. The is_selected boolean in each array node indicates whether the user has selected that keytype to be returned in the current search. The application must ensure that the boolean reflects the current state of the user's desires prior to any search. Typically this is done by having the keytypes array track user interface toggle buttons for the database. DtSrResult Structuretypedef struct _DtSrResult { The API function DtSearchQuery returns a results list upon successful completion of a search. A results list is a linked list of DtSrResult structures, where each node represents a database document that satisfied the query.
DtSrHitword Structuretypedef struct { Given a text string and the array of search terms returned from DtSearchQuery, DtSearchHighlight will generate a table of offsets and lengths where the search terms are located in the text. The table is typically used to highlight the search terms in the text is a manner appropriate to the application's user interface. The DtSrHitword structure is one element in the table. For each search term to be highlighted, offset specifies the beginning byte for the term, and length specifies the extent of the term in bytes. SEE ALSODtSrAPI(3), DtSearchInit(3), DtSearchReinit(3), DtSearchExit(3), DtSearchGetKeytypes(3), DtSearchSetMaxResults(3), DtSearchGetMaxResults(3), DtSearchQuery(3), DtSearchRetrieve(3), DtSearchHighlight(3), DtSearchValidDateString(3), DtSearchMergeResults(3), DtSearchSortResults(3), DtSearchFreeResults(3), DtSearchHasMessages(3), DtSearchAddMessages(3), DtSearchGetMessages(3), DtSearchFreeMessages(3), DtSearch(5)
|