- zs = start_service(""); /* default to zebra.cfg */
- zh = zebra_open (zs);
- zebra_select_database(zh, "Default");
- logf(LOG_LOG,"going to call init");
- i=zebra_init(zh);
- logf(LOG_LOG,"init returned %d",i);
- if (i) {
- printf("init failed with %d\n",i);
- zebra_result(zh, &i, &addinfo);
- printf(" Error %d %s\n",i,addinfo);
- exit(1);
- }
-
- zebra_begin_trans (zh, 1);
- for (i = 0; recs[i]; i++)
- zebra_add_record (zh, recs[i], strlen(recs[i]));
- zebra_end_trans (zh);
-
- zebra_select_database(zh, "Default");
-
- qry( zh, "@attr 1=1016 @attr 2=102 the",
- 3, "first title", 872 );
-
- qry( zh, "@attr 1=1016 @attr 2=102 foo",
- 3, "second title", 850 );
-
- /* get the record with the most significant hit, that is the 'bar' */
- /* as that is the rarest of my search words */
- qry( zh, "@attr 1=1016 @attr 2=102 @or @or the foo bar",
- 3, "third title", 895 );
-