Fixed and added a few Doxygen comments. Got rid of redundant function
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Jun 2005 11:59:53 +0000 (11:59 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Jun 2005 11:59:53 +0000 (11:59 +0000)
rset_get_no_terms.

data1/d1_if.c
include/idzebra/api.h
include/rset.h
index/zebraapi.c
index/zrpn.c
rset/rset.c
rset/rsnull.c

index 1ec54db..6d56b49 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: d1_if.c,v 1.6 2005-01-15 19:38:18 adam Exp $
+/* $Id: d1_if.c,v 1.7 2005-06-02 11:59:53 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -246,14 +246,9 @@ data1_node *data1_LookupNode(data1_node* node, char* pTagPath)
 }
 
 /**
 }
 
 /**
-
-data1_CountOccurences
-
-Count the number of occurences of the last instance on a tagpath.
-
-@param data1_node* node : The root of the tree we wish to look for occurences in
-@param const char* pTagPath : The tagpath we want to count the occurences of... 
-
+   \brief Count the number of occurences of the last instance on a tagpath.
+   \param node : The root of the tree we wish to look for occurences in
+   \param pTagPath : The tagpath we want to count the occurences of... 
 */
 int data1_CountOccurences(data1_node* node, char* pTagPath)
 {
 */
 int data1_CountOccurences(data1_node* node, char* pTagPath)
 {
index 1886b5b..bd6516a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: api.h,v 1.24 2005-05-24 11:35:41 adam Exp $
+/* $Id: api.h,v 1.25 2005-06-02 11:59:53 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -100,89 +100,87 @@ YAZ_EXPORT
 ZebraService zebra_start_res(const char *configName,
                             Res def_res, Res over_res);
 
 ZebraService zebra_start_res(const char *configName,
                             Res def_res, Res over_res);
 
-/** \fn ZEBRA_RES zebra_stop(ZebraService zs)
-    \brief stops a Zebra service.
-    \param zs service handle
-    
-    Frees resources used by the service.
+/**
+   \brief stops a Zebra service.
+   \param zs service handle
+   
+   Frees resources used by the service.
 */
 YAZ_EXPORT
 ZEBRA_RES zebra_stop(ZebraService zs);
 
 */
 YAZ_EXPORT
 ZEBRA_RES zebra_stop(ZebraService zs);
 
-/** \fn void zebra_filter_info(ZebraService zs, void *cd, \
-                               void(*cb)(void *cd, const char *name))
-    \brief lists enabled Zebra filters
-    \param zs service handle
-    \param cd callback parameter (opaque)
-    \param cb callback function
+/**
+   \brief Lists enabled Zebra filters
+   \param zs service handle
+   \param cd callback parameter (opaque)
+   \param cb callback function
  */
 YAZ_EXPORT
 void zebra_filter_info(ZebraService zs, void *cd,
                       void (*cb)(void *cd, const char *name));
 
 
  */
 YAZ_EXPORT
 void zebra_filter_info(ZebraService zs, void *cd,
                       void (*cb)(void *cd, const char *name));
 
 
-/** \fn ZebraHandle zebra_open(ZebraService zs)
-    \brief creates a Zebra session handle within service.
-    \param zs service handle.
-    
-    There should be one handle for each thread doing something
-    with zebra, be that searching or indexing. In simple apps 
-    one handle is sufficient 
+/**
+   \brief Creates a Zebra session handle within service.
+   \param zs service handle.
+   
+   There should be one handle for each thread doing something
+   with zebra, be that searching or indexing. In simple apps 
+   one handle is sufficient 
 */
 YAZ_EXPORT
 ZebraHandle zebra_open(ZebraService zs);
 
 */
 YAZ_EXPORT
 ZebraHandle zebra_open(ZebraService zs);
 
-/** \fn int zebra_close(ZebraHandle zh)
-    \brief destroys Zebra session handle.
-    \param zh zebra session handle.
+/**
+   \brief Destroys Zebra session handle.
+   \param zh zebra session handle.
  */
 YAZ_EXPORT
 ZEBRA_RES zebra_close(ZebraHandle zh);
 
  */
 YAZ_EXPORT
 ZEBRA_RES zebra_close(ZebraHandle zh);
 
-/** \fn int zebra_errCode(ZebraHandle zh)
-    \brief returns error code for last error
-    \param zh zebra session handle.
+/**
+   \brief Returns error code for last error
+   \param zh zebra session handle.
 */
 YAZ_EXPORT
 int zebra_errCode(ZebraHandle zh);
 
 */
 YAZ_EXPORT
 int zebra_errCode(ZebraHandle zh);
 
-/** \fn const char *zebra_errString(ZebraHandle zh)
-    \brief returns error string for last error
-    \param zh zebra session handle.
+/**
+   \brief Returns error string for last error
+   \param zh zebra session handle.
 */
 YAZ_EXPORT
 const char *zebra_errString(ZebraHandle zh);
 
 */
 YAZ_EXPORT
 const char *zebra_errString(ZebraHandle zh);
 
-/** \fn char *zebra_errAdd(ZebraHandle zh)
-    \brief returns additional info for last error
-    \param zh zebra session handle.
+/**
+   \brief Returns additional info for last error
+   \param zh zebra session handle.
 */
 YAZ_EXPORT
 char *zebra_errAdd(ZebraHandle zh);
 
 */
 YAZ_EXPORT
 char *zebra_errAdd(ZebraHandle zh);
 
-/** \fn int zebra_result(ZebraHandle zh, int *code, char **addinfo)
-    \brief returns error code and additional info for last error
-    \param zh zebra session handle.
-    \param code pointer to returned error code
-    \param addinfo pointer to returned additional info
+/**
+   \brief Returns error code and additional info for last error
+   \param zh zebra session handle.
+   \param code pointer to returned error code
+   \param addinfo pointer to returned additional info
 */
 YAZ_EXPORT
 void zebra_result(ZebraHandle zh, int *code, char **addinfo);
 
 */
 YAZ_EXPORT
 void zebra_result(ZebraHandle zh, int *code, char **addinfo);
 
-/** \fn void zebra_clearError(ZebraHandle zh)
-    \brief clears last error.
+/** 
+    \brief Clears last error.
     \param zh zebra session handle.
     \param zh zebra session handle.
- */
+*/
 YAZ_EXPORT
 void zebra_clearError(ZebraHandle zh);
 
 YAZ_EXPORT
 void zebra_clearError(ZebraHandle zh);
 
-/** \fn ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query, \
-               const char *setname, zint *hits)
-    \brief Search using PQF Query 
-    \param zh session handle
-    \param pqf_query query
-    \param setname name of resultset
-    \param hits of hits is returned
+/**
+   \brief Search using PQF Query 
+   \param zh session handle
+   \param pqf_query query
+   \param setname name of resultset
+   \param hits of hits is returned
  */
 YAZ_EXPORT
 ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
  */
 YAZ_EXPORT
 ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
@@ -206,7 +204,7 @@ ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
                const char *setname, Z_RecordComposition *comp, \
                oid_value input_format, int num_recs, \
                ZebraRetrievalRecord *recs)
                const char *setname, Z_RecordComposition *comp, \
                oid_value input_format, int num_recs, \
                ZebraRetrievalRecord *recs)
-    \brief retrieve records from result set (after search)
+    \brief Retrieve records from result set (after search)
     \param zh session handle
     \param stream allocate records returned using this ODR
     \param setname name of result set to retrieve records from
     \param zh session handle
     \param stream allocate records returned using this ODR
     \param setname name of result set to retrieve records from
@@ -223,9 +221,7 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
                                 int num_recs,
                                 ZebraRetrievalRecord *recs);
 /**
                                 int num_recs,
                                 ZebraRetrievalRecord *recs);
 /**
-   \fn int zebra_deleteResultSet(ZebraHandle zh, int function, \
-               int num_setnames, char **setnames, int *statuses)
-   \brief delete one or more resultsets 
+   \brief Deletes one or more resultsets 
    \param zh session handle
    \param function Z_DeleteResultSetRequest_{list,all}
    \param num_setnames number of result sets
    \param zh session handle
    \param function Z_DeleteResultSetRequest_{list,all}
    \param num_setnames number of result sets
@@ -250,10 +246,6 @@ ZEBRA_RES zebra_result_set_term_info(ZebraHandle zh, const char *setname,
 
 
 /**
 
 
 /**
-   \fn ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, \
-               Z_AttributesPlusTerm *zapt, oid_value attributeset, \
-               int *position, int *num_entries, ZebraScanEntry **list, \
-               int *is_partial)
    \brief performs Scan (Z39.50 style)
    \param zh session handle
    \param stream ODR handle for result
    \brief performs Scan (Z39.50 style)
    \param zh session handle
    \param stream ODR handle for result
@@ -261,35 +253,32 @@ ZEBRA_RES zebra_result_set_term_info(ZebraHandle zh, const char *setname,
    \param attributeset Attributeset for Attribute plus Term
    \param position input/output position
    \param num_entries number of terms requested / returned 
    \param attributeset Attributeset for Attribute plus Term
    \param position input/output position
    \param num_entries number of terms requested / returned 
-   \param list list of resulting terms (ODR allocated)
+   \param entries list of resulting terms (ODR allocated)
    \param is_partial upon return 1=partial, 0=complete
 */
 YAZ_EXPORT ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream,
                                Z_AttributesPlusTerm *zapt,
                                oid_value attributeset,
                                int *position, int *num_entries,
    \param is_partial upon return 1=partial, 0=complete
 */
 YAZ_EXPORT ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream,
                                Z_AttributesPlusTerm *zapt,
                                oid_value attributeset,
                                int *position, int *num_entries,
-                               ZebraScanEntry **list,
+                               ZebraScanEntry **entries,
                                int *is_partial);
 
 /**
                                int *is_partial);
 
 /**
-   \fn ZEBRA_RES 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 
    \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 entries list of resulting terms (ODR allocated)
    \param is_partial upon return 1=partial, 0=complete
 */
 YAZ_EXPORT
 ZEBRA_RES zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
                    int *position, int *num_entries, ZebraScanEntry **entries,
                    int *is_partial);
    \param is_partial upon return 1=partial, 0=complete
 */
 YAZ_EXPORT
 ZEBRA_RES zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
                    int *position, int *num_entries, ZebraScanEntry **entries,
                    int *is_partial);
+
 /**
 /**
-   \fn ZEBRA_RES zebra_auth(ZebraHandle zh, const char *user, const char *pass)
    \brief authenticate user. Returns 0 if OK, != 0 on failure
    \param zh session handle
    \param user user name
    \brief authenticate user. Returns 0 if OK, != 0 on failure
    \param zh session handle
    \param user user name
@@ -299,10 +288,7 @@ YAZ_EXPORT
 ZEBRA_RES zebra_auth(ZebraHandle zh, const char *user, const char *pass);
 
 /**
 ZEBRA_RES zebra_auth(ZebraHandle zh, const char *user, const char *pass);
 
 /**
-   \fn int zebra_string_norm(ZebraHandle zh, unsigned reg_id, \
-               const char *input_str, int input_len, \
-               char *output_str, int output_len)
-   \brief normalize zebra term for register (subject to change!)
+   \brief Normalize zebra term for register (subject to change!)
    \param zh session handle
    \param reg_id register ID, 'w', 'p',..
    \param input_str input string buffer
    \param zh session handle
    \param reg_id register ID, 'w', 'p',..
    \param input_str input string buffer
@@ -315,8 +301,7 @@ int zebra_string_norm(ZebraHandle zh, unsigned reg_id, const char *input_str,
                int input_len, char *output_str, int output_len);
 
 /**
                int input_len, char *output_str, int output_len);
 
 /**
-   \fn ZEBRA_RES zebra_create_database(ZebraHandle zh, const char *db)
-   \brief creates a database
+   \brief Creates a database
    \param zh session handle
    \param db database to be created
 */
    \param zh session handle
    \param db database to be created
 */
@@ -324,8 +309,7 @@ YAZ_EXPORT
 ZEBRA_RES zebra_create_database(ZebraHandle zh, const char *db);
 
 /**
 ZEBRA_RES zebra_create_database(ZebraHandle zh, const char *db);
 
 /**
-   \fn int zebra_drop_database(ZebraHandle zh, const char *db)
-   \brief deletes a database (drop)
+   \brief Deletes a database (drop)
    \param zh session handle
    \param db database to be deleted
 */
    \param zh session handle
    \param db database to be deleted
 */
index 23f7d0d..593d666 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rset.h,v 1.52 2005-05-24 11:35:41 adam Exp $
+/* $Id: rset.h,v 1.53 2005-06-02 11:59:53 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -32,25 +32,25 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 YAZ_BEGIN_CDECL
 
 
 YAZ_BEGIN_CDECL
 
-typedef struct rsfd *RSFD; /* Rset "file descriptor" */
-typedef struct rset *RSET; /* Result set */
-
+typedef struct rsfd *RSFD;
+typedef struct rset *RSET;
 
 /** 
  * rset_term is all we need to know of a term to do ranking etc. 
  * As far as the rsets are concerned, it is just a dummy pointer to
  * be passed around.
  */
 
 /** 
  * rset_term is all we need to know of a term to do ranking etc. 
  * As far as the rsets are concerned, it is just a dummy pointer to
  * be passed around.
  */
-
 struct rset_term {
 struct rset_term {
-    /** the term itself */
-    char *name;
-    char *flags;
-    int  type;
-    /** the rset corresponding to this term */
-    RSET rset;
-    /** private stuff for the ranking algorithm */
-    void *rankpriv;
+    char *name;    /** the term itself in internal encoding (UTF-8/raw) */
+    char *flags;   /** flags for rank method */
+    int  type;     /** Term_type from RPN Query. Actually this
+                      is Z_Term_general, Z_Term_numeric,
+                      Z_Term_characterString, ..
+                      This info is used to return encoded term back for
+                      search-result-1 .
+                  */
+    RSET rset;     /** the rset corresponding to this term */
+    void *rankpriv;/** private stuff for the ranking algorithm */
 };
 
 typedef struct rset_term *TERMID; 
 };
 
 typedef struct rset_term *TERMID; 
@@ -103,13 +103,6 @@ int rset_default_forward(RSFD rfd, void *buf, TERMID *term,
 /** rset_default_read implements a generic read */
 int rset_default_read(RSFD rfd, void *buf, TERMID *term);
 
 /** rset_default_read implements a generic read */
 int rset_default_read(RSFD rfd, void *buf, TERMID *term);
 
-/** rset_get_no_terms is a getterms function for those that don't have any */
-void rset_get_no_terms(RSET ct, TERMID *terms, int maxterms, int *curterm);
-
-/** 
- * rset_get_one_term is a getterms function for those rsets that have
- * exactly one term, like all rsisamX types. 
- */
 void rset_get_one_term(RSET ct,TERMID *terms,int maxterms,int *curterm);
 
 /**
 void rset_get_one_term(RSET ct,TERMID *terms,int maxterms,int *curterm);
 
 /**
@@ -145,15 +138,13 @@ typedef struct rset
 {
     const struct rset_control *control;
     struct rset_key_control *keycontrol;
 {
     const struct rset_control *control;
     struct rset_key_control *keycontrol;
-    int  refcount;  /* reference count */
-    void *priv;     /* stuff private to the given type of rset */
-    NMEM nmem;      /* nibble memory for various allocs */
-    char my_nmem;   /* Should the nmem be destroyed with the rset?  */
-                    /* 1 if created with it, 0 if passed from above */
-    RSFD free_list; /* all rfd's allocated but not currently in use */
-    RSFD use_list;  /* all rfd's in use */
-    int scope;      /* On what level do we count hits and compare them? */
-    TERMID term;    /* the term thing for ranking etc */
+    int  refcount;   /* reference count */
+    void *priv;      /* stuff private to the given type of rset */
+    NMEM nmem;       /* nibble memory for various allocs */
+    RSFD free_list;  /* all rfd's allocated but not currently in use */
+    RSFD use_list;   /* all rfd's in use */
+    int scope;       /* On what level do we count hits and compare them? */
+    TERMID term;     /* the term thing for ranking etc */
     int no_children;
     RSET *children;
     zint hits_limit;
     int no_children;
     RSET *children;
     zint hits_limit;
index 9ff2d7c..f87f209 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.172 2005-05-31 17:10:06 adam Exp $
+/* $Id: zebraapi.c,v 1.173 2005-06-02 11:59:53 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -1002,11 +1002,11 @@ ZEBRA_RES zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
     return res;
 }
 
     return res;
 }
 
-ZEBRA_RES zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                     oid_value attributeset,
-                     int *position,
-                     int *num_entries, ZebraScanEntry **entries,
-                     int *is_partial)
+ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
+                    oid_value attributeset,
+                    int *position,
+                    int *num_entries, ZebraScanEntry **entries,
+                    int *is_partial)
 {
     ZEBRA_RES res;
     ASSERTZH;
 {
     ZEBRA_RES res;
     ASSERTZH;
@@ -1301,20 +1301,20 @@ static int delete_SU_handle(void *handle, int ord)
     return 0;
 }
 
     return 0;
 }
 
-ZEBRA_RES zebra_drop_database  (ZebraHandle zh, const char *database)
+ZEBRA_RES zebra_drop_database(ZebraHandle zh, const char *db)
 {
     ZEBRA_RES ret = ZEBRA_OK;
     ASSERTZH;
 {
     ZEBRA_RES ret = ZEBRA_OK;
     ASSERTZH;
-    yaz_log(log_level, "zebra_drop_database");
+    yaz_log(log_level, "zebra_drop_database %s", db);
     zebra_clearError(zh);
 
     zebra_clearError(zh);
 
-    if (zebra_select_database (zh, database) == ZEBRA_FAIL)
+    if (zebra_select_database (zh, db) == ZEBRA_FAIL)
         return ZEBRA_FAIL;
     if (zebra_begin_trans (zh, 1) == ZEBRA_FAIL)
         return ZEBRA_FAIL;
     if (zh->reg->isamb)
     {
         return ZEBRA_FAIL;
     if (zebra_begin_trans (zh, 1) == ZEBRA_FAIL)
         return ZEBRA_FAIL;
     if (zh->reg->isamb)
     {
-       zebraExplain_curDatabase (zh->reg->zei, database);
+       zebraExplain_curDatabase (zh->reg->zei, db);
        
        zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
        zebraExplain_removeDatabase(zh->reg->zei, zh);
        
        zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
        zebraExplain_removeDatabase(zh->reg->zei, zh);
@@ -1328,24 +1328,24 @@ ZEBRA_RES zebra_drop_database  (ZebraHandle zh, const char *database)
     return ret;
 }
 
     return ret;
 }
 
-ZEBRA_RES zebra_create_database (ZebraHandle zh, const char *database)
+ZEBRA_RES zebra_create_database (ZebraHandle zh, const char *db)
 {
     ASSERTZH;
 {
     ASSERTZH;
-    yaz_log(log_level, "zebra_create_database %s", database);
-    assert(database);
+    yaz_log(log_level, "zebra_create_database %s", db);
+    assert(db);
     zebra_clearError(zh);
 
     zebra_clearError(zh);
 
-    if (zebra_select_database (zh, database) == ZEBRA_FAIL)
+    if (zebra_select_database (zh, db) == ZEBRA_FAIL)
         return ZEBRA_FAIL;
     if (zebra_begin_trans (zh, 1))
         return ZEBRA_FAIL;
 
     /* announce database */
         return ZEBRA_FAIL;
     if (zebra_begin_trans (zh, 1))
         return ZEBRA_FAIL;
 
     /* announce database */
-    if (zebraExplain_newDatabase (zh->reg->zei, database, 0 
+    if (zebraExplain_newDatabase (zh->reg->zei, db, 0 
                                   /* explainDatabase */))
     {
         zebra_end_trans (zh);
                                   /* explainDatabase */))
     {
         zebra_end_trans (zh);
-       zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED, database);
+       zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED, db);
        return ZEBRA_FAIL;
     }
     return zebra_end_trans (zh);
        return ZEBRA_FAIL;
     }
     return zebra_end_trans (zh);
@@ -2140,9 +2140,9 @@ ZEBRA_RES zebra_delete_record (ZebraHandle zh,
 */
 
 ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
 */
 
 ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
-                          const char *setname, zint *numhits)
+                          const char *setname, zint *hits)
 {
 {
-    zint hits = 0;
+    zint lhits = 0;
     ZEBRA_RES res = ZEBRA_OK;
     Z_RPNQuery *query;
     ODR odr = odr_createmem(ODR_ENCODE);
     ZEBRA_RES res = ZEBRA_OK;
     Z_RPNQuery *query;
     ODR odr = odr_createmem(ODR_ENCODE);
@@ -2161,14 +2161,14 @@ ZEBRA_RES zebra_search_PQF(ZebraHandle zh, const char *pqf_query,
        res = ZEBRA_FAIL;
     }
     else
        res = ZEBRA_FAIL;
     }
     else
-        res = zebra_search_RPN(zh, odr, query, setname, &hits);
+        res = zebra_search_RPN(zh, odr, query, setname, &lhits);
     
     odr_destroy(odr);
 
     
     odr_destroy(odr);
 
-    yaz_log(log_level, "Hits: " ZINT_FORMAT, hits);
+    yaz_log(log_level, "Hits: " ZINT_FORMAT, lhits);
 
 
-    if (numhits)
-       *numhits = hits;
+    if (hits)
+       *hits = lhits;
 
     return res;
 }
 
     return res;
 }
index 951f83f..9f3fbec 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zrpn.c,v 1.193 2005-05-31 13:01:37 adam Exp $
+/* $Id: zrpn.c,v 1.194 2005-06-02 11:59:54 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -1523,7 +1523,23 @@ static ZEBRA_RES grep_info_prepare(ZebraHandle zh,
     return ZEBRA_OK;
 }
                                
     return ZEBRA_OK;
 }
                                
-
+/**
+  \brief Create result set(s) for list of terms
+  \param zh Zebra Handle
+  \param termz_org term as used in query but converted to UTF-8
+  \param attributeSet default attribute set
+  \param stream memory for result
+  \param reg_type register type ('w', 'p',..)
+  \param complete_flag whether it's phrases or not
+  \param rank_type term flags for ranking
+  \param xpath_use use attribute for X-Path (-1 for no X-path)
+  \param num_bases number of databases
+  \param basenames array of databases
+  \param rset_mem memory for result sets
+  \param result_sets output result set for each term in list (output)
+  \param number number of output result sets
+  \param kc rset key control to be used for created result sets
+*/
 static ZEBRA_RES term_list_trunc(ZebraHandle zh,
                                 Z_AttributesPlusTerm *zapt,
                                 const char *termz_org,
 static ZEBRA_RES term_list_trunc(ZebraHandle zh,
                                 Z_AttributesPlusTerm *zapt,
                                 const char *termz_org,
@@ -2329,14 +2345,23 @@ static ZEBRA_RES rpn_search_APT(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
     if (sort_flag)
         return rpn_sort_spec(zh, zapt, attributeSet, stream, sort_sequence,
                             rank_type, rset_nmem, rset, kc);
     if (sort_flag)
         return rpn_sort_spec(zh, zapt, attributeSet, stream, sort_sequence,
                             rank_type, rset_nmem, rset, kc);
+    /* consider if an X-Path query is used */
     xpath_len = parse_xpath(zh, zapt, attributeSet, xpath, 10, stream);
     if (xpath_len >= 0)
     {
     xpath_len = parse_xpath(zh, zapt, attributeSet, xpath, 10, stream);
     if (xpath_len >= 0)
     {
-        xpath_use = 1016;
-        if (xpath[xpath_len-1].part[0] == '@')
-            xpath_use = 1015;
-    }
-
+        xpath_use = 1016;  /* searching for element by default */
+        if (xpath[xpath_len-1].part[0] == '@') 
+            xpath_use = 1015;  /* last step an attribute .. */
+    }
+
+    /* search using one of the various search type strategies
+       termz is our UTF-8 search term
+       attributeSet is top-level default attribute set 
+       stream is ODR for search
+       reg_id is the register type
+       complete_flag is 1 for complete subfield, 0 for incomplete
+       xpath_use is use-attribute to be used for X-Path search, 0 for none
+    */
     if (!strcmp(search_type, "phrase"))
     {
         res = rpn_search_APT_phrase(zh, zapt, termz, attributeSet, stream,
     if (!strcmp(search_type, "phrase"))
     {
         res = rpn_search_APT_phrase(zh, zapt, termz, attributeSet, stream,
index 16aaf31..38f02e8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rset.c,v 1.46 2005-05-24 11:35:43 adam Exp $
+/* $Id: rset.c,v 1.47 2005-06-02 11:59:54 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -30,13 +30,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 static int log_level = 0;
 static int log_level_initialized = 0;
 
 static int log_level = 0;
 static int log_level_initialized = 0;
 
-/** \fn rfd_create_base(RSET rs)
- *
- * creates an rfd. Either allocates a new one, in which case the priv 
- * pointer is null, and will have to be filled in, or picks up one 
- * from the freelist, in which case the priv is already allocated,
- * and presumably everything that hangs from it as well 
- */
+/**
+   \brief Common constuctor for RFDs
+   \param rs Result set handle.
+   
+   Creates an rfd. Either allocates a new one, in which case the priv 
+   pointer is null, and will have to be filled in, or picks up one 
+   from the freelist, in which case the priv is already allocated,
+   and presumably everything that hangs from it as well 
+*/
 RSFD rfd_create_base(RSET rs)
 {
     RSFD rnew = rs->free_list;
 RSFD rfd_create_base(RSET rs)
 {
     RSFD rnew = rs->free_list;
@@ -63,10 +65,10 @@ RSFD rfd_create_base(RSET rs)
     return rnew;
 }
 
     return rnew;
 }
 
-/** \fn rfd_delete_base
- *
- * puts an rfd into the freelist of the rset. Only when the rset gets
- * deleted, will all the nmem disappear */
+/**
+   \brief Closes a result set RFD handle
+   \param rfd the RFD handle.
+*/
 void rset_close(RSFD rfd)
 {
     RSFD *pfd;
 void rset_close(RSFD rfd)
 {
     RSFD *pfd;
@@ -127,31 +129,37 @@ void rset_close(RSFD rfd)
            rs->control->desc);
 }
 
            rs->control->desc);
 }
 
+/**
+   \brief Common constuctor for RSETs
+   \param sel The interface control handle
+   \param nmem The memory handle for it.
+   \param kcontrol Key control info (decode, encode, comparison etc)
+   \param scope scope for set
+   \param term Information about term for it (NULL for none).
+   \param no_children number of child rsets (0 for none)
+   \param children child rsets (NULL for none).
+   
+   Creates an rfd. Either allocates a new one, in which case the priv 
+   pointer is null, and will have to be filled in, or picks up one 
+   from the freelist, in which case the priv is already allocated,
+   and presumably everything that hangs from it as well 
+*/
 RSET rset_create_base(const struct rset_control *sel, 
                       NMEM nmem, struct rset_key_control *kcontrol,
                       int scope, TERMID term,
                      int no_children, RSET *children)
 {
     RSET rset;
 RSET rset_create_base(const struct rset_control *sel, 
                       NMEM nmem, struct rset_key_control *kcontrol,
                       int scope, TERMID term,
                      int no_children, RSET *children)
 {
     RSET rset;
-    NMEM M;
-    assert(nmem);  /* can not yet be used, api/t4 fails */
+    assert(nmem);
     if (!log_level_initialized) 
     {
         log_level = yaz_log_module_level("rset");
         log_level_initialized = 1;
     }
 
     if (!log_level_initialized) 
     {
         log_level = yaz_log_module_level("rset");
         log_level_initialized = 1;
     }
 
-    if (nmem) 
-        M = nmem;
-    else
-        M = nmem_create();
-    rset = (RSET) nmem_malloc(M, sizeof(*rset));
+    rset = (RSET) nmem_malloc(nmem, sizeof(*rset));
     yaz_log(log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rset, nmem); 
     yaz_log(log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rset, nmem); 
-    rset->nmem = M;
-    if (nmem)
-        rset->my_nmem = 0;
-    else 
-        rset->my_nmem = 1;
+    rset->nmem = nmem;
     rset->control = sel;
     rset->refcount = 1;
     rset->priv = 0;
     rset->control = sel;
     rset->refcount = 1;
     rset->priv = 0;
@@ -178,6 +186,13 @@ RSET rset_create_base(const struct rset_control *sel,
     return rset;
 }
 
     return rset;
 }
 
+/**
+   \brief Destructor RSETs
+   \param rs Handle for result set.
+   
+   Destroys a result set and all its children.
+   The f_delete method of control is called for the result set.
+*/
 void rset_delete(RSET rs)
 {
     (rs->refcount)--;
 void rset_delete(RSET rs)
 {
     (rs->refcount)--;
@@ -193,11 +208,15 @@ void rset_delete(RSET rs)
            rset_delete(rs->children[i]);
         (*rs->control->f_delete)(rs);
        (*rs->keycontrol->dec)(rs->keycontrol);
            rset_delete(rs->children[i]);
         (*rs->control->f_delete)(rs);
        (*rs->keycontrol->dec)(rs->keycontrol);
-        if (rs->my_nmem)
-            nmem_destroy(rs->nmem);
     }
 }
 
     }
 }
 
+/**
+   \brief Test for last use of RFD
+   \param rfd RFD handle.
+   
+   Returns 1 if this RFD is the last reference to it; 0 otherwise.
+*/
 int rfd_is_last(RSFD rfd)
 {
     if (rfd->rset->use_list == rfd && rfd->next == 0)
 int rfd_is_last(RSFD rfd)
 {
     if (rfd->rset->use_list == rfd && rfd->next == 0)
@@ -205,6 +224,12 @@ int rfd_is_last(RSFD rfd)
     return 0;
 }
 
     return 0;
 }
 
+/**
+   \brief Duplicate an RSET
+   \param rs Handle for result set.
+   
+   Duplicates a result set by incrementing the reference count to it.
+*/
 RSET rset_dup (RSET rs)
 {
     (rs->refcount)++;
 RSET rset_dup (RSET rs)
 {
     (rs->refcount)++;
@@ -215,11 +240,14 @@ RSET rset_dup (RSET rs)
 }
 
 /** 
 }
 
 /** 
- * rset_count uses rset_pos to get the total and returns that.
- * This is ok for rsisamb/c/s, and for some other rsets, but in case of
- * booleans etc it will give bad estimate, as nothing has been read
- * from that rset
- */
+    \brief Estimates hit count for result set.
+    \param rs Result Set.
+
+    rset_count uses rset_pos to get the total and returns that.
+    This is ok for rsisamb/c/s, and for some other rsets, but in case of
+    booleans etc it will give bad estimate, as nothing has been read
+    from that rset
+*/
 zint rset_count(RSET rs)
 {
     double cur, tot;
 zint rset_count(RSET rs)
 {
     double cur, tot;
@@ -229,24 +257,34 @@ zint rset_count(RSET rs)
     return (zint) tot;
 }
 
     return (zint) tot;
 }
 
-/** rset_get_no_terms is a getterms function for those that don't have any */
-void rset_get_no_terms(RSET ct, TERMID *terms, int maxterms, int *curterm)
-{
-    return;
-}
+/**
+   \brief is a getterms function for those that don't have any
+   \param ct result set handle
+   \param terms array of terms (0..maxterms-1)
+   \param maxterms length of terms array
+   \param curterm current size of terms array
 
 
-/* rset_get_one_term gets that one term from an rset. Used by rsisamX */
+   If there is a term associated with rset the term is appeneded; otherwise
+   the terms array is untouched but curterm is incremented anyway.
+*/
 void rset_get_one_term(RSET ct, TERMID *terms, int maxterms, int *curterm)
 {
     if (ct->term)
     {
         if (*curterm < maxterms)
             terms[*curterm] = ct->term;
 void rset_get_one_term(RSET ct, TERMID *terms, int maxterms, int *curterm)
 {
     if (ct->term)
     {
         if (*curterm < maxterms)
             terms[*curterm] = ct->term;
-        (*curterm)++;
+       (*curterm)++;
     }
 }
 
     }
 }
 
-
+/**
+   \brief Creates a TERMID entry.
+   \param name Term/Name buffer with given length
+   \param length of term
+   \param flags for term
+   \param type Term Type, Z_Term_general, Z_Term_characterString,..
+   \param nmem memory for term.
+*/
 TERMID rset_term_create(const char *name, int length, const char *flags,
                        int type, NMEM nmem)
 
 TERMID rset_term_create(const char *name, int length, const char *flags,
                        int type, NMEM nmem)
 
index cc427c7..8c5522f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsnull.c,v 1.35 2005-05-24 11:35:43 adam Exp $
+/* $Id: rsnull.c,v 1.36 2005-06-02 11:59:54 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -36,7 +36,7 @@ static const struct rset_control control =
 {
     "null",
     r_delete,
 {
     "null",
     r_delete,
-    rset_get_no_terms,
+    rset_get_one_term,
     r_open,
     r_close,
     0, /* no forward */
     r_open,
     r_close,
     0, /* no forward */
@@ -95,4 +95,3 @@ static int r_write(RSFD rfd, const void *buf)
     yaz_log(YLOG_FATAL, "NULL set type is read-only");
     return -1;
 }
     yaz_log(YLOG_FATAL, "NULL set type is read-only");
     return -1;
 }
-