Changed the way use attributes are specified in the recordId
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 11 Jun 1998 15:42:20 +0000 (15:42 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 11 Jun 1998 15:42:20 +0000 (15:42 +0000)
specification.

CHANGELOG
doc/zebra.sgml
index/extract.c

index f74b770..2f2bd84 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Changed the way use attributes are specified in the recordId
+specification.
+
 Maximum number of databases in one Zebra register increased.
 
 New setting, databasePath, which specifies that first directory
 Maximum number of databases in one Zebra register increased.
 
 New setting, databasePath, which specifies that first directory
index e204727..4a78a1d 100644 (file)
@@ -1,14 +1,14 @@
 <!doctype linuxdoc system>
 
 <!--
 <!doctype linuxdoc system>
 
 <!--
-  $Id: zebra.sgml,v 1.40 1998-02-10 12:03:05 adam Exp $
+  $Id: zebra.sgml,v 1.41 1998-06-11 15:42:21 adam Exp $
 -->
 
 <article>
 <title>Zebra Server - Administrators's Guide and Reference
 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">,
 <tt><htmlurl url="mailto:info@indexdata.dk" name="info@indexdata.dk"></>
 -->
 
 <article>
 <title>Zebra Server - Administrators's Guide and Reference
 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">,
 <tt><htmlurl url="mailto:info@indexdata.dk" name="info@indexdata.dk"></>
-<date>$Revision: 1.40 $
+<date>$Revision: 1.41 $
 <abstract>
 The Zebra information server combines a versatile fielded/free-text
 search engine with a Z39.50-1995 frontend to provide a powerful and flexible
 <abstract>
 The Zebra information server combines a versatile fielded/free-text
 search engine with a Z39.50-1995 frontend to provide a powerful and flexible
@@ -560,7 +560,7 @@ There are three kinds of tokens:
 <tag>Internal record info</tag> The token refers to a key that is
 extracted from the record. The syntax of this token is
  <tt/(/ <em/set/ <tt/,/ <em/use/ <tt/)/, where <em/set/ is the
 <tag>Internal record info</tag> The token refers to a key that is
 extracted from the record. The syntax of this token is
  <tt/(/ <em/set/ <tt/,/ <em/use/ <tt/)/, where <em/set/ is the
-attribute set ordinal number and <em/use/ is the use value of the attribute.
+attribute set name <em/use/ is the name or value of the attribute.
 <tag>System variable</tag> The system variables are preceded by
 <verb>$</verb> and immediately followed by the system variable name, which
 may one of
 <tag>System variable</tag> The system variables are preceded by
 <verb>$</verb> and immediately followed by the system variable name, which
 may one of
@@ -574,18 +574,18 @@ may one of
 </descrip>
 
 For instance, the sample GILS records that come with the Zebra
 </descrip>
 
 For instance, the sample GILS records that come with the Zebra
-distribution contain a
-unique ID
-in the Control-Identifier field. This field is mapped to the Bib-1
-use attribute 1007. To use this field as a record id, specify
-<tt>(1,1007)</tt> as the value of the <tt>recordId</tt> in the
-configuration file. If you have other record types that uses
-the same field for a different purpose, you might add the record type (or group or database name)
-to the record id of the gils records as well, to prevent matches
-with other types of records. In this case the recordId might be
-set like this:
+distribution contain a unique ID in the data tagged Control-Identifier.
+The data is mapped to the Bib-1 use attribute Identifier-standard
+(code 1007). To use this field as a record id, specify
+<tt>(bib1,Identifier-standard)</tt> as the value of the
+<tt>recordId</tt> in the configuration file.
+If you have other record types that uses the same field for a
+different purpose, you might add the record type
+(or group or database name) to the record id of the gils
+records as well, to prevent matches with other types of records.
+In this case the recordId might be set like this:
 <tscreen><verb>
 <tscreen><verb>
-gils.recordId: $type (1,1007)
+gils.recordId: $type (bib1,Identifier-standard)
 </verb></tscreen>
 
 (see section <ref id="data-model" name="Configuring Your Data Model">
 </verb></tscreen>
 
 (see section <ref id="data-model" name="Configuring Your Data Model">
index b12769c..f0f3d12 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.83  1998-06-08 14:43:10  adam
+ * Revision 1.84  1998-06-11 15:42:22  adam
+ * Changed the way use attributes are specified in the recordId
+ * specification.
+ *
+ * Revision 1.83  1998/06/08 14:43:10  adam
  * Added suport for EXPLAIN Proxy servers - added settings databasePath
  * and explainDatabase to facilitate this. Increased maximum number
  * of databases and attributes in one register.
  * Added suport for EXPLAIN Proxy servers - added settings databasePath
  * and explainDatabase to facilitate this. Increased maximum number
  * of databases and attributes in one register.
@@ -999,26 +1003,13 @@ static void file_end (void *handle, off_t offset)
     p->file_moffset = offset;
 }
 
     p->file_moffset = offset;
 }
 
-static int atois (const char **s)
-{
-    int val = 0, c;
-    while ( (c=**s) >= '0' && c <= '9')
-    {
-        val = val*10 + c - '0';
-        ++(*s);
-    }
-    return val;
-}
-
 static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
 static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
-                           const char *fname,
-                           const char *spec)
+                           const char *fname, const char *spec)
 {
     static char dstBuf[2048];
     char *dst = dstBuf;
     const char *s = spec;
     static const char **w;
 {
     static char dstBuf[2048];
     char *dst = dstBuf;
     const char *s = spec;
     static const char **w;
-    int i;
 
     while (1)
     {
 
     while (1)
     {
@@ -1028,21 +1019,39 @@ static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
             break;
         if (*s == '(')
         {
             break;
         if (*s == '(')
         {
+           char attset_str[64], attname_str[64];
+           data1_attset *attset;
+           int i;
             char matchFlag[32];
             char matchFlag[32];
-            int attrSet, attrUse;
+            int attSet = 1, attUse = 1;
             int first = 1;
 
             s++;
             int first = 1;
 
             s++;
-            attrSet = atois (&s);
-            if (*s != ',')
-            {
-                logf (LOG_WARN, "Missing , in match criteria %s in group %s",
-                      spec, rGroup->groupName ? rGroup->groupName : "none");
-                return NULL;
-            }
-            s++;
-            attrUse = atois (&s);
-            w = searchRecordKey (reckeys, attrSet, attrUse);
+           for (i = 0; *s && *s != ',' && *s != ')'; s++)
+               if (i < 63)
+                   attset_str[i++] = *s;
+           attset_str[i] = '\0';
+
+           if (*s == ',')
+           {
+               s++;
+               for (i = 0; *s && *s != ')'; s++)
+                   if (i < 63)
+                       attname_str[i++] = *s;
+               attname_str[i] = '\0';
+           }
+           
+           if ((attset = data1_get_attset (rGroup->dh, attset_str)))
+           {
+               data1_att *att;
+               attSet = attset->reference;
+               att = data1_getattbyname(rGroup->dh, attset, attname_str);
+               if (att)
+                   attUse = att->value;
+               else
+                   attUse = atoi (attname_str);
+           }
+            w = searchRecordKey (reckeys, attSet, attUse);
             assert (w);
 
             if (*s == ')')
             assert (w);
 
             if (*s == ')')
@@ -1072,7 +1081,7 @@ static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
             if (first)
             {
                 logf (LOG_WARN, "Record didn't contain match"
             if (first)
             {
                 logf (LOG_WARN, "Record didn't contain match"
-                      " fields in (%d,%d)", attrSet, attrUse);
+                      " fields in (%s,%s)", attset_str, attname_str);
                 return NULL;
             }
         }
                 return NULL;
             }
         }