|
NAMEafsearch - query a set of databases SYNOPSIS#include af.h int afsearch(const Afsearch *r, Afsearch_r *rr); DESCRIPTIONThe afsearch function searches one or more databases and returns an unordered list of resultant documents. The argument r specifies a set of options defined by the following structure: typedef struct {
Uint2 *dbid;
int dbidn;
Afchar *query;
int qtype;
int score;
} Afsearch;
The dbid option specifies an array of databases to be searched. The databases are referred to by their database descriptors, as returned by afopen(3). The dbidn option specifies how many databases are in the array dbid. The query option specifies the query string to be applied in the search. The qtype option describes the query type used in query. Currently there is only one query type supported:
The score option specifies how relevance scores should be calculated:
RETURN VALUEThis function returns 0 if it exited normally. If an error occurred, it returns -1 and aferrno is set. If the function exited normally, the structure pointed to by rr is filled in with the following values: typedef struct {
Afresult *result;
int resultn;
} Afsearch_r;
The result value is an array of results, each corresponding to a unique document that matched the query. The resultn value is the number of elements in result. Each element of result is of the following type: typedef struct {
Uint4 docid;
Uint2 score;
Uint2 dbid;
} Afresult;
The docid is the document identifier. The score is the computed relevance score, normally a value in the range, 0 to 10000. The dbid is the descriptor of the database containing the document. Additional processing of results is provided by afsortscore(3), afsortdocid(3), and afgetresultmd(3). ERRORSIn addition to the set of "core" errors, this function can return:
|