Get rid of typedefs iSAMS_P, ISAMC_P, ISAMB_P and use ISAM_P instead.
[idzebra-moved-to-github.git] / index / zebraapi.c
index d0f4e79..f3165d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.153 2005-03-08 14:02:12 adam Exp $
+/* $Id: zebraapi.c,v 1.158 2005-04-13 13:03:47 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -345,10 +345,10 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name,
     if (res_get_match (res, "isam", "c", ISAM_DEFAULT))
     {
        struct ISAMC_M_s isamc_m;
-       if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC,
+       if (!(reg->isamc = isamc_open (reg->bfs, FNAME_ISAMC,
                                    rw, key_isamc_m(res, &isamc_m))))
        {
-           yaz_log (YLOG_WARN, "isc_open failed");
+           yaz_log (YLOG_WARN, "isamc_open failed");
            return 0;
        }
     }
@@ -439,7 +439,7 @@ static void zebra_register_close (ZebraService zs, struct zebra_register *reg)
        if (reg->isams)
            isams_close (reg->isams);
         if (reg->isamc)
-            isc_close (reg->isamc);
+            isamc_close (reg->isamc);
         if (reg->isamb)
             isamb_close (reg->isamb);
         rec_close (&reg->records);
@@ -952,10 +952,28 @@ int zebra_records_retrieve (ZebraHandle zh, ODR stream,
     return ret;
 }
 
+int zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
+                  int *position, int *num_entries, ZebraScanEntry **entries,
+                  int *is_partial)
+{
+    YAZ_PQF_Parser pqf_parser = yaz_pqf_create ();
+    Z_AttributesPlusTerm *zapt;
+    int *attributeSet;
+    
+    if (!(zapt = yaz_pqf_scan(pqf_parser, stream, &attributeSet, query)))
+    {
+       yaz_pqf_destroy (pqf_parser);
+       return -1;
+    }
+    yaz_pqf_destroy (pqf_parser);
+    return zebra_scan(zh, stream, zapt, VAL_BIB1,
+                     position, num_entries, entries, is_partial);
+}
+
 int zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                oid_value attributeset,
-                int *position, int *num_entries, ZebraScanEntry **entries,
-                int *is_partial)
+               oid_value attributeset,
+               int *position, int *num_entries, ZebraScanEntry **entries,
+               int *is_partial)
 {
     ASSERTZH;
     assert(stream);
@@ -1225,7 +1243,7 @@ int zebra_admin_exchange_record (ZebraHandle zh,
 int delete_w_handle(const char *info, void *handle)
 {
     ZebraHandle zh = (ZebraHandle) handle;
-    ISAMC_P pos;
+    ISAM_P pos;
     ASSERTZH;
 
     if (*info == sizeof(pos))
@@ -2112,7 +2130,7 @@ int zebra_search_PQF (ZebraHandle zh, const char *pqf_query,
     
     odr_destroy(odr);
 
-    yaz_log(log_level, "Hits: %d",hits);
+    yaz_log(log_level, "Hits: " ZINT_FORMAT, hits);
 
     if (numhits)
        *numhits = hits;
@@ -2159,3 +2177,9 @@ int zebra_sort_by_specstr (ZebraHandle zh, ODR stream,
     return sort_status;
 }
 
+struct BFiles_struct *zebra_get_bfs(ZebraHandle zh)
+{
+    if (zh && zh->reg)
+       return zh->reg->bfs;
+    return 0;
+}