The following table describes the RDMHeader and RDMQuery object parameters in the first (left) column and provides a description of the corresponding parameter in the second (right) column
ID of the search engine instance. This parameter specifies the specific search engine that you created in the search engine Administration Interface. You can find the exact value in /var/opt/SUNWportal/searchservers/search1/config/search.conf. For SSL enabled server instances, use x-catalogs instead of x-catalog in the CSID.
Query string. The default is to search for documents containing the string varrius. For example, if you want to search for all documents containing the string style_sheets, then set MY_SCOPE to style_sheets.
Attributes to be printed, such as URL, title and description.
This example generates an RDM for querying a search engine database. You can pipe the output of the sample program to a temporary file and then use the sendrdm program to post it to the search engine.
/******* Example Use of the RDM API to submit a query *******/ #include <stdio.h> #include “soif.h” #include “rdm.h” #define MY_SCOPE “varrius” #define MY_CSID “x-catalog://budgie.siroe.com:6714/search1” #define MY_ATTR_VIEW “title,content-type” int main(int argc, char *argv) { RDMQuery *myquery = NULL; CSID *csid = NULL; RDMHeader *myheader = NULL; SOIFStream *out = SOIF_PrintInitFile(stdout); /* Create the RDMQuery and specify its scope */ if(!(myquery = RDMQuery_Create(MY_SCOPE))) { perror(“RDMQuery_Create\\n”); exit(-1); } /* Set the view attributes of the RDMQuery */ RDMQuery_SetViewAttr(myquery, MY_ATTR_VIEW); /* Create the CSID that points to your search engine instance */ if(!(csid = CSID_Parse(MY_CSID))) { perror(“CSID_Parse\\n”); exit(-1); } /* Create the RDMHeader */ if(!(myheader = RDMHeader_CreateRequest(RDM_RD_REQ, “search”, csid))) { perror(“RDMHeader_CreateRequest\\n”); exit(-1); } /* print the RDMHeader to the output SOIF stream */ /* print the RDMQuery to the output SOIF stream */ (*out->print)(out, myheader->soif); (*out->print)(out, myquery->soif); /* free the structures and exit */ RDMHeader_Free(myheader); RDMQuery_Free(myquery); SOIFStream_Finish(out); exit(0); } /*********** EOF ****************/ |