DTSRAPI(3)
okay so bestie, you're looking at DtSrAPI, and it's a library call page β the manual entry that describes the overview, constants, and structures for the DtSearch online API. Buckle up, because this is part 1 and it's giving reference material in the best way π
β¨ NAME β¨
DtSrAPI β describes overview, constants, and structures for DtSearch online API. periodt.
π DESCRIPTION π
The DtSearch API gives you programmatic access to the DtSearch search and retrieval engine. The API functions live in the library libDtSr, and they're directly linked into user-written search programs. no cap.
Search and retrieval of DtSearch databases is available through three essential API functions:
DtSearchInitβ opens databases and other files, and generally initializes the search engine for subsequent requests. it's the setup bestie πDtSearchQueryβ is passed a user query and some search options, performs the requested search, and returns a linked list of structures called a results list, representing the objects satisfying the search. The results list contains abstracted information about the documents suitable for display to an end user, as well as private information used for subsequent retrievals. main character energy fr fr π₯DtSearchRetrieveβ retrieves an object given data from a results list node. When a results list contains all the information an application needs, retrieval by DtSearch may not be required. For example, when the documents themselves are not stored in DtSearch databases and the document references are available from the results list, the calling program may access the objects directly. lowkey convenient π
πΈ DtSearch MessageList πΈ
All 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. so don't assume silence means perfection, bestie π
Messages are standard C text strings terminated by a zero byte, and were designed to be displayed directly to users. cute and functional π
Several API utility functions are available for manipulating the MessageList.
π¦ Fatal API Errors π¦
Certain 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. highkey important π¨
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. the way that's both iconic and terrifying π«Ά
π CONSTANTS π
π Function Return Code Constants π
Most 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. vibe check on every return, bestie β¨
DtSrOKβ normal, affirmative, successful response. slay πDtSrNOTAVAILβ generic negative response. For example, no hits on search, no such record, etc. it's giving "nothing here" π«DtSrFAILβ miscellaneous unsuccessful engine returns. not the moment πDtSrREINITβ engine reinitialized, request canceled. Often returned when invalid database name detected. Caller should clean up and callDtSearchReinit(). okay so reset era πDtSrERRORβ fatal caller programming error. bestie, that's on you πDtSrABORTβ fatal engine failure, caller must abort. no cap, this one's serious π¨
π Language Numbers π
Each 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. iykyk π
DtSrLaENGβ0β English, ASCII char set (default)DtSrLaENG2β1β English, ISO Latin-1 char setDtSrLaESPβ2β Spanish, ISO Latin-1 char setDtSrLaFRAβ3β French, ISO Latin-1 char setDtSrLaITAβ4β Italian, ISO Latin-1 char setDtSrLaDEUβ5β German, ISO Latin-1 char setDtSrLaJPNβ6β Japanese, EUC, auto kanji compoundsDtSrLaJPN2β7β Japanese, EUC, listed kanji compoundsDtSrLaLASTβ7β last supportedDtSrLaconstant
β Other General Constants β
DtSrVERSIONβ DtSearch version number string. the flex πDtSrMAX_KTNAMEβ maximum string length of a keytype name.DtSrMAX_DB_KEYSIZEβ maximum size of the unique document key.DtSrMAXWIDTH_HWORDβ largest possible word or stem size.DtSrMAX_STEMCOUNTβ maximum number of boolean search terms.
π DtSrObjdate Type π
DtSrObjdate is a typdef (yes, that's the exact spelling in the source, bestie β not me π) 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. efficient queen π
DtSrObjdate are based on the western Gregorian calendar and are not guaranteed to map to other time locales. so like, calendar behavior is not universal, noted ποΈ
DtSearch objdates have a range from 1900 to 5995 inclusive and a resolution of 1 minute. From hi order bits to low:
12bits =tm_yearβ (0-4095, years since1900(1900-5995))4bits =tm_monβ (0-11, month name index)5bits =tm_mdayβ (1-31, day of month)5bits =tm_hourβ (0-23, hours since midnight)6bits =tm_minβ (0-59, minutes since top of hour)
π STRUCTURES π
okay bestie, this is where the actual data shapes live β the little structs that carry all the search tea ββ¨
π DtSrKeytype Type π
typedef struct {
char is_selected;
char ktchar;
char name [ DtSrMAX_KTNAME+1];
} DtSrKeytype;
A DtSearch keytype references a logical subset of the database. periodt.
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. cute little label-maker energy π
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. so likeβ¦ keep the toggles in sync, bestie π
β¨ DtSrResult Structure β¨
typedef struct _DtSrResult {
struct _DtSrResult *link;
long flags;
long objflags;
long objuflags;
long objsize;
DtSrObjdates objdate;
short objtype;
short objcost;
int dbn;
DB_ADDR dba;
short language;
char reckey [DtSrMAX_DB_KEYSIZE];
int proximity;
char *abstractp;
} 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. linked-list realness π₯
linkβ Pointer to the next results list node.flagsβ (reserved)objflagsβ The constantDtSrFlNOTAVAILmeans that the object is not retrievable from the search engine.objuflagsβ User flags from database record. These are not used byDtSearchand are available for application definition.objsizeβ In uncompressed bytes.objdateβ Zero is the null date; document is 'undated'.objtypeβ Document type from database header record.Objtypeis typically used by application code to identify and launch browsers.
Values above x1000 (4096) are set aside for application definition. The following constants identify defined values:
DtSrObjUNKNOWNβ Document type unknown or not applicableDtSrObjTEXTβ Generic, unformatted flat textDtSrObjBINARYβ Generic binary objectDtSrObjSGMLβ Generic SGML formatted documentDtSrObjHTMLβ HTML formatted documentDtSrObjPOSTSCRβ Postscript documentDtSrObjINTERLFβ Interleaf documentDtSrObjDTINFOβ DtInfo document
objcostβ (reserved)dbnβ Database number; index intodbnamesarray fromDtSearchInitandDtSearchReinit.dbaβ Atomic document identifier within a database.languageβ Language number of the databaseDtSrLa...constant).reckeyβ Document's unique database key. The first character ofreckeyis the keytype character.proximityβ Sort field for ranking results lists. Derived from frequency of occurrence statistics for the query words in the document. Often displayed to users as the subjective 'distance' between the document and the query, in other words a measure of the likelihood that the document will satisfy the user's needs.abstractpβ Document's abstract string from the database.
ngl this struct is giving βmain character energyβ β it carries the whole search result on its back π«Ά
π¦ DtSrHitword Structure π¦
typedef struct {
long offset; /* word location in cleartext */
long length; /* length of word */
} DtSrHitword;
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 in 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. highlighting slay β¨
π SEE ALSO π
DtSrAPI(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)
okay bestie, that's the whole page π the footer on this one is DtSrAPI(library call) β and there's no date listed, so she's timeless like a little Unix ghost πβ¨. now go forth and highlight those hitwords, fr fr π
π¦ where this page comes from
- nixos 26.05: cde 2.5.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms