Added zebra_scan_PQF.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Apr 2005 08:52:26 +0000 (08:52 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Apr 2005 08:52:26 +0000 (08:52 +0000)
include/idzebra/api.h
index/zebraapi.c

index d3a9d4b..0c139d0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: api.h,v 1.16 2005-03-17 08:31:53 adam Exp $
+/* $Id: api.h,v 1.17 2005-04-13 08:52:26 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -224,7 +224,6 @@ YAZ_EXPORT int zebra_deleteResultSet(ZebraHandle zh, int function,
                                     int num_setnames, char **setnames,
                                     int *statuses);
 
                                     int num_setnames, char **setnames,
                                     int *statuses);
 
-
 /**
    \fn int zebra_scan(ZebraHandle zh, ODR stream,
    Z_AttributesPlusTerm *zapt, oid_value attributeset,
 /**
    \fn int zebra_scan(ZebraHandle zh, ODR stream,
    Z_AttributesPlusTerm *zapt, oid_value attributeset,
@@ -246,7 +245,23 @@ YAZ_EXPORT int zebra_scan(ZebraHandle zh, ODR stream,
                          ZebraScanEntry **list,
                          int *is_partial);
 
                          ZebraScanEntry **list,
                          int *is_partial);
 
-             
+/**
+   \fn int zebra_scan_PQF(ZebraHandle zh, ODR stream,
+   const char *query, int *position, int *num_entries, ZebraScanEntry **list, int *is_partial)
+   \brief performs Scan (taking PQF string)
+   \param zh session handle
+   \param stream ODR handle for result
+   \param query PQF scan query
+   \param position input/output position
+   \param num_entries number of terms requested / returned 
+   \param list list of resulting terms (ODR allocated)
+   \param is_partial upon return 1=partial, 0=complete
+*/
+YAZ_EXPORT int zebra_scan_PQF(ZebraHandle zh, ODR stream,
+                             const char *query,
+                             int *position, int *num_entries,
+                             ZebraScanEntry **entries,
+                             int *is_partial);
 /**
    \fn int zebra_auth(ZebraHandle zh, const char *user, const char *pass)
    \brief authenticate user. Returns 0 if OK, != 0 on failure
 /**
    \fn int zebra_auth(ZebraHandle zh, const char *user, const char *pass)
    \brief authenticate user. Returns 0 if OK, != 0 on failure
index 24ae25f..e6530e7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.156 2005-03-17 08:31:53 adam Exp $
+/* $Id: zebraapi.c,v 1.157 2005-04-13 08:52:27 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -952,10 +952,28 @@ int zebra_records_retrieve (ZebraHandle zh, ODR stream,
     return ret;
 }
 
     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,
 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);
 {
     ASSERTZH;
     assert(stream);