CCL: s=ag automatically adds s=pw
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 10 Sep 2012 10:55:22 +0000 (12:55 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 10 Sep 2012 10:55:22 +0000 (12:55 +0200)
Apply structure=word/phrase for ag. It really makes no sense to not
apply them.

src/cclfind.c
test/test_ccl.c

index 51f06c4..f7903fe 100644 (file)
@@ -462,13 +462,11 @@ static struct ccl_rpn_node *search_term_x(CCL_parser cclp,
                     }
                 }
         }
-        /* len now holds the number of characters in the RPN term */
-        /* no holds the number of CCL tokens (1 or more) */
-        
-        if (structure_value == -1 && 
-            qual_val_type(qa, CCL_BIB1_STR, CCL_BIB1_STR_WP, &attset))
-        {   /* no structure attribute met. Apply either structure attribute 
-               WORD or PHRASE depending on number of CCL tokens */
+        if (structure_value == -1 && (
+                auto_group || 
+                qual_val_type(qa, CCL_BIB1_STR, CCL_BIB1_STR_WP, &attset))
+            )
+        {
             if (!is_phrase)
                 ccl_add_attr_numeric(p, attset, CCL_BIB1_STR, 2);
             else
index 5b5d571..4cc8423 100644 (file)
@@ -86,7 +86,7 @@ void tst1(int pass)
         ccl_qual_fitem(bibset, "r=o",         "x");
         ccl_qual_fitem(bibset, "dc.title", "title");
         ccl_qual_fitem(bibset, "term dc.title", "comb");
-        ccl_qual_fitem(bibset, "s=ag,pw", "ag");
+        ccl_qual_fitem(bibset, "s=ag", "ag");
         break;
     case 1:
         strcpy(tstline, "ti u=4    s=pw t=l,r");
@@ -116,7 +116,7 @@ void tst1(int pass)
         strcpy(tstline, "comb term dc.title # combination");
         ccl_qual_line(bibset, tstline);
 
-        strcpy(tstline, "ag s=ag,pw");
+        strcpy(tstline, "ag s=ag");
         ccl_qual_line(bibset, tstline);
         break;
     case 2:
@@ -130,7 +130,7 @@ void tst1(int pass)
                      "x r=o\n"
                      "title dc.title\n"
                      "comb term dc.title\n"
-                     "ag s=ag,pw\n"
+                     "ag s=ag\n"
             );
         break;
     case 3:
@@ -175,7 +175,7 @@ void tst1(int pass)
                 "   <qual name=\"dc.title\"/>\n"
                 " </qual>\n"
                 " <qual name=\"ag\">\n"
-                "   <attr type=\"s\" value=\"ag,pw\"/>\n"
+                "   <attr type=\"s\" value=\"ag\"/>\n"
                 " </qual>\n"
                 "</cclmap>\n";