Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 29 May 2014 15:07:59 +0000 (17:07 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 29 May 2014 15:07:59 +0000 (17:07 +0200)
include/yaz/ccl.h
src/cclfind.c
src/cclqfile.c
test/test_ccl.c
util/bib1

index 5b9ac5c..d701095 100644 (file)
@@ -358,6 +358,7 @@ struct ccl_rpn_attr *ccl_parser_qual_search(CCL_parser cclp, const char *name,
 #define CCL_BIB1_STR_AUTO_GROUP (-4)
 #define CCL_BIB1_REL_ORDER (-1)
 #define CCL_BIB1_REL_PORDER (-2)
+#define CCL_BIB1_REL_OMIT_EQUALS (-3)
 
 #define CCL_BIB1_TRU_CAN_LEFT (-1)
 #define CCL_BIB1_TRU_CAN_RIGHT (-2)
index 1d4f6c6..a5bde82 100644 (file)
@@ -799,7 +799,9 @@ struct ccl_rpn_node *qualifiers_order(CCL_parser cclp,
     {
         if (!(p = search_terms(cclp, ap)))
             return NULL;
-        ccl_add_attr_numeric(p, attset, CCL_BIB1_REL, rel);
+        if (rel != 3 ||
+            !qual_val_type(ap, CCL_BIB1_REL, CCL_BIB1_REL_OMIT_EQUALS, 0))
+            ccl_add_attr_numeric(p, attset, CCL_BIB1_REL, rel);
         return p;
     }
     return NULL;
index 943f84d..df98f33 100644 (file)
@@ -132,6 +132,8 @@ int ccl_qual_field2(CCL_bibset bibset, const char *cp, const char *qual_name,
                         value = CCL_BIB1_REL_ORDER;
                     else if (!ccl_stricmp (value_str, "r"))
                         value = CCL_BIB1_REL_PORDER;
+                    else if (!ccl_stricmp (value_str, "omiteq"))
+                        value = CCL_BIB1_REL_OMIT_EQUALS;
                     break;
                 case 'p':
                 case 'P':
index a0b76a0..a78dfdf 100644 (file)
@@ -82,7 +82,7 @@ void tst1(int pass)
         ccl_qual_fitem(bibset, "t=x", "reg");
         ccl_qual_fitem(bibset, "t=z", "z");
         ccl_qual_fitem(bibset, "1=/my/title",       "dc.title");
-        ccl_qual_fitem(bibset, "r=r",         "date");
+        ccl_qual_fitem(bibset, "r=r,omiteq",        "date");
         ccl_qual_fitem(bibset, "r=o",         "x");
         ccl_qual_fitem(bibset, "dc.title", "title");
         ccl_qual_fitem(bibset, "term dc.title", "comb");
@@ -104,7 +104,7 @@ void tst1(int pass)
         strcpy(tstline, "dc.title 1=/my/title");
         ccl_qual_line(bibset, tstline);
 
-        strcpy(tstline, "date r=r # ordered relation");
+        strcpy(tstline, "date r=r,omiteq # ordered relation");
         ccl_qual_line(bibset, tstline);
 
         strcpy(tstline, "x r=o # ordered relation");
@@ -126,7 +126,7 @@ void tst1(int pass)
                      "reg t=x\r\n"
                      "z t=z\r\n"
                      "dc.title 1=/my/title\n"
-                     "date r=r\n"
+                     "date r=r,omiteq\n"
                      "x r=o\n"
                      "title dc.title\n"
                      "comb term dc.title\n"
@@ -162,7 +162,7 @@ void tst1(int pass)
                 "   <attr type=\"1\" value=\"/my/title\"/>\n"
                 " </qual>\n"
                 " <qual name=\"date\">\n"
-                "   <attr type=\"r\" value=\"r\"/>\n"
+                "   <attr type=\"r\" value=\"r,omiteq\"/>\n"
                 " </qual>\n"
                 " <qual name=\"x\">\n"
                 "   <attr type=\"r\" value=\"o\"/>\n"
@@ -271,9 +271,17 @@ void tst1(int pass)
                             "@attr 4=2 @attr 1=1016 c " ));
 
     YAZ_CHECK(tst_ccl_query(bibset, "date=1980",
-                            "@attr 2=3 1980 "));
+                            "1980 "));
     YAZ_CHECK(tst_ccl_query(bibset, "(date=1980)",
-                            "@attr 2=3 1980 "));
+                            "1980 "));
+    YAZ_CHECK(tst_ccl_query(bibset, "date>1980",
+                            "@attr 2=5 1980 "));
+    YAZ_CHECK(tst_ccl_query(bibset, "date>=1980",
+                            "@attr 2=4 1980 "));
+    YAZ_CHECK(tst_ccl_query(bibset, "date<1980",
+                            "@attr 2=1 1980 "));
+    YAZ_CHECK(tst_ccl_query(bibset, "date<=1980",
+                            "@attr 2=2 1980 "));
     YAZ_CHECK(tst_ccl_query(bibset, "date=234-1990",
                             "@and @attr 2=4 234 @attr 2=2 1990 "));
     YAZ_CHECK(tst_ccl_query(bibset, "date=234- 1990",
index fa73875..b2a8352 100644 (file)
--- a/util/bib1
+++ b/util/bib1
@@ -1,7 +1,7 @@
 ti       u=4    s=pw t=l,r
 term     1=1016 s=al,pw t=r
 dc.title 1=/my/title
-date     r=r
-x        r=o
+date     1=31 r=r,omiteq
+x        1=x r=o
 title    dc.title
 comb     term dc.title