Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/pazpar2
authorDennis Schafroth <dennis@indexdata.com>
Mon, 25 Jun 2012 11:12:53 +0000 (13:12 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Mon, 25 Jun 2012 11:12:53 +0000 (13:12 +0200)
26 files changed:
src/client.c
src/http_command.c
src/pazpar2_config.c
src/pazpar2_config.h
src/reclists.c
src/relevance.c
src/relevance.h
src/session.c
src/session.h
test/Makefile.am
test/test_http.cfg
test/test_http.urls
test/test_http_77.res [new file with mode: 0644]
test/test_http_78.res [new file with mode: 0644]
test/test_http_79.res [new file with mode: 0644]
test/test_url.urls
test/test_url_15.res [new file with mode: 0644]
test/test_url_16.res [new file with mode: 0644]
test/test_url_17.res [new file with mode: 0644]
test/test_url_18.res [new file with mode: 0644]
test/test_url_settings.xml [new file with mode: 0644]
test/test_url_settings_1.xml [deleted file]
test/test_url_settings_2.xml [deleted file]
test/test_url_settings_3.xml [deleted file]
test/test_url_settings_4.xml [deleted file]
test/z3950_indexdata_com_marc.xml

index 25b75d3..2b270ae 100644 (file)
@@ -412,16 +412,12 @@ static int nativesyntax_to_type(const char *s, char *type,
             const char *cp = strchr(s, ';');
             yaz_snprintf(type, 80, "xml; charset=%s", cp ? cp+1 : "marc-8s");
         }
-        else if (!strncmp(s, "xml", 3))
-        {
-            strcpy(type, "xml");
-        }
         else if (!strncmp(s, "txml", 4))
         {
             const char *cp = strchr(s, ';');
             yaz_snprintf(type, 80, "txml; charset=%s", cp ? cp+1 : "marc-8s");
         }
-        else
+        else /* pass verbatim to ZOOM - including "xml" */
             strcpy(type, s);
         return 0;
     }
@@ -1290,8 +1286,7 @@ int client_parse_query(struct client *cl, const char *query,
     if (!se->relevance)
     {
         // Initialize relevance structure with query terms
-        se->relevance = relevance_create_ccl(
-            se->service->charsets, se->nmem, cn);
+        se->relevance = relevance_create_ccl(se->service->charsets, cn);
     }
     ccl_rpn_delete(cn);
     return ret_value;
index 84fac12..c92c7c3 100644 (file)
@@ -1173,7 +1173,8 @@ static void cmd_show(struct http_channel *c)
         release_session(c, s);
         return;
     }
-    session_sort(s->psession, sp->name, sp->increasing);
+    session_sort(s->psession, sp->name, sp->increasing,
+                 sp->type == Metadata_sortkey_position);
 
     status = session_active_clients(s->psession);
 
index bff5810..b2064f9 100644 (file)
@@ -72,7 +72,7 @@ static void conf_metadata_assign(NMEM nmem,
                                  enum conf_setting_type setting,
                                  int brief,
                                  int termlist,
-                                 int rank,
+                                 const char *rank,
                                  int sortkey_offset,
                                  enum conf_metadata_mergekey mt,
                                  const char *facetrule,
@@ -93,7 +93,7 @@ static void conf_metadata_assign(NMEM nmem,
     metadata->setting = setting;
     metadata->brief = brief;   
     metadata->termlist = termlist;
-    metadata->rank = rank;    
+    metadata->rank = nmem_strdup_null(nmem, rank);
     metadata->sortkey_offset = sortkey_offset;
     metadata->mergekey = mt;
     metadata->facetrule = nmem_strdup_null(nmem, facetrule);
@@ -173,7 +173,7 @@ static struct conf_metadata* conf_service_add_metadata(
     enum conf_setting_type setting,
     int brief,
     int termlist,
-    int rank,
+    const char *rank,
     int sortkey_offset,
     enum conf_metadata_mergekey mt,
     const char *facetrule,
@@ -281,7 +281,6 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
     enum conf_metadata_mergekey mergekey_type = Metadata_mergekey_no;
     int brief = 0;
     int termlist = 0;
-    int rank = 0;
     int sortkey_offset = 0;
     xmlChar *xml_name = 0;
     xmlChar *xml_brief = 0;
@@ -294,6 +293,7 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
     xmlChar *xml_mergekey = 0;
     xmlChar *xml_limitmap = 0;
     xmlChar *xml_icu_chain = 0;
+
     struct _xmlAttr *attr;
     for (attr = n->properties; attr; attr = attr->next)
     {
@@ -365,9 +365,6 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
         }
     }
     
-    if (xml_rank)
-        rank = atoi((const char *) xml_rank);
-
     if (xml_type)
     {
         if (!strcmp((const char *) xml_type, "generic"))
@@ -469,8 +466,11 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
     conf_service_add_metadata(service, *md_node,
                               (const char *) xml_name,
                               type, merge, setting,
-                              brief, termlist, rank, sortkey_offset,
-                              mergekey_type, (const char *) xml_icu_chain, (const char *) xml_limitmap);
+                              brief, termlist,
+                              (const char *) xml_rank, sortkey_offset,
+                              mergekey_type,
+                              (const char *) xml_icu_chain,
+                              (const char *) xml_limitmap);
     (*md_node)++;
     return 0;
 }
index 692d260..193adcf 100644 (file)
@@ -73,9 +73,7 @@ struct conf_metadata
     char *name;  // The field name. Output by normalization stylesheet
     int brief;   // Is this element to be returned in the brief format?
     int termlist;// Is this field to be treated as a termlist for browsing?
-    int rank;    // Rank factor. 0 means don't use this field for ranking, 
-                 // 1 is default
-                 // values >1  give additional significance to a field
+    const char *rank;
     int sortkey_offset; // -1 if it's not a sortkey, otherwise index
                         // into service/record_cluster->sortkey array
     enum conf_metadata_type type;
@@ -85,7 +83,6 @@ struct conf_metadata
     char *facetrule;
 
     char *limitmap;  // Should be expanded into service-wide default e.g. pz:limitmap:<name>=value setting
-    char *facetmap;  // Should be expanded into service-wide default e.g. pz:facetmap:<name>=value setting
 };
 
 
index 2ba9b4d..c2b45e7 100644 (file)
@@ -64,10 +64,10 @@ struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
         char parm[256];
         char *pp;
         const char *cpp;
-        int increasing;
+        int increasing = 0;
         int i;
         int offset = 0;
-        enum conf_sortkey_type type;
+        enum conf_sortkey_type type = Metadata_sortkey_string;
         struct reclist_sortparms *new;
 
         if (!(cpp = strchr(parms, ',')))
@@ -77,39 +77,56 @@ struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
 
         if ((pp = strchr(parm, ':')))
         {
-            increasing = pp[1] == '1' ? 1 : 0;
+            if (pp[1] == '1')
+                increasing = 1;
+            else if (pp[1] == '0')
+                increasing = 0;
+            else
+            {
+                yaz_log(YLOG_FATAL, "Bad sortkey modifier: %s", parm);
+                return 0;
+            }
+           
+            if (pp[2])
+            {
+                if (pp[2] == 'p')
+                    type = Metadata_sortkey_position;
+                else
+                    yaz_log(YLOG_FATAL, "Bad sortkey modifier: %s", parm);
+            }
             *pp = '\0';
         }
-        else
-            increasing = 0;
-        if (!strcmp(parm, "relevance"))
-        {
-            type = Metadata_sortkey_relevance;
-        } 
-        else if (!strcmp(parm, "position"))
-        {
-            type = Metadata_sortkey_position;
-        }
-        else
+        if (type != Metadata_sortkey_position)
         {
-            for (i = 0; i < service->num_sortkeys; i++)
+            if (!strcmp(parm, "relevance"))
             {
-                struct conf_sortkey *sk = &service->sortkeys[i];
-                if (!strcmp(sk->name, parm))
-                {
-                    type = sk->type;
-                    if (type == Metadata_sortkey_skiparticle)
-                        type = Metadata_sortkey_string;
-                    break;
-                }
-            }
-            if (i >= service->num_sortkeys)
+                type = Metadata_sortkey_relevance;
+            } 
+            else if (!strcmp(parm, "position"))
             {
-                yaz_log(YLOG_FATAL, "Bad sortkey: %s", parm);
-                return 0;
+                type = Metadata_sortkey_position;
             }
             else
+            {
+                for (i = 0; i < service->num_sortkeys; i++)
+                {
+                    struct conf_sortkey *sk = &service->sortkeys[i];
+                    if (!strcmp(sk->name, parm))
+                    {
+                        type = sk->type;
+                        if (type == Metadata_sortkey_skiparticle)
+                            type = Metadata_sortkey_string;
+                        break;
+                    }
+                }
+                if (i >= service->num_sortkeys)
+                {
+                    yaz_log(YLOG_FATAL, "Sortkey not defined in service: %s",
+                            parm);
+                    return 0;
+                }
                 offset = i;
+            }
         }
         new = *rp = nmem_malloc(nmem, sizeof(struct reclist_sortparms));
         new->next = 0;
@@ -179,10 +196,7 @@ static int reclist_cmp(const void *p1, const void *p2)
                 for (rec = r2->records; rec; rec = rec->next)
                     if (pos2 == 0 || rec->position < pos2)
                         pos2 = rec->position;
-                if (s->increasing)
-                    res = pos1 - pos2;
-                else
-                    res = pos2 - pos1;
+                res = pos1 - pos2;
             }
             break;
         default:
index a365ebd..bc9cb1a 100644 (file)
@@ -44,34 +44,51 @@ struct word_entry {
     struct word_entry *next;
 };
 
-int word_entry_match(struct word_entry *entries, const char *norm_str)
+static int word_entry_match(struct word_entry *entries, const char *norm_str,
+                            const char *rank, int *mult)
 {
     for (; entries; entries = entries->next)
     {
         if (!strcmp(norm_str, entries->norm_str))
+        {
+            const char *cp = 0;
+            int no_read = 0;
+            sscanf(rank, "%d%n", mult, &no_read);
+            rank += no_read;
+            while (*rank == ' ')
+                rank++;
+            if (no_read > 0 && (cp = strchr(rank, ' ')))
+            {
+                if ((cp - rank) == strlen(entries->ccl_field) &&
+                    memcmp(entries->ccl_field, rank, cp - rank) == 0)
+                    *mult = atoi(cp + 1);
+            }
             return entries->termno;
+        }
     }
     return 0;
 }
 
 void relevance_countwords(struct relevance *r, struct record_cluster *cluster,
-                          const char *words, int multiplier, const char *name)
+                          const char *words, const char *rank,
+                          const char *name)
 {
     int *mult = cluster->term_frequency_vec_tmp;
     const char *norm_str;
     int i, length = 0;
-
     pp2_charset_token_first(r->prt, words, 0);
     for (i = 1; i < r->vec_len; i++)
         mult[i] = 0;
 
+    assert(rank);
     while ((norm_str = pp2_charset_token_next(r->prt)))
     {
-        int res = word_entry_match(r->entries, norm_str);
+        int local_mult = 0;
+        int res = word_entry_match(r->entries, norm_str, rank, &local_mult);
         if (res)
         {
             assert(res < r->vec_len);
-            mult[res] += multiplier;
+            mult[res] += local_mult;
         }
         length++;
     }
@@ -130,8 +147,9 @@ static void pull_terms(struct relevance *res, struct ccl_rpn_node *n)
 }
 
 struct relevance *relevance_create_ccl(pp2_charset_fact_t pft,
-                                       NMEM nmem, struct ccl_rpn_node *query)
+                                       struct ccl_rpn_node *query)
 {
+    NMEM nmem = nmem_create();
     struct relevance *res = nmem_malloc(nmem, sizeof(*res));
     int i;
 
@@ -153,6 +171,7 @@ void relevance_destroy(struct relevance **rp)
     if (*rp)
     {
         pp2_charset_token_destroy((*rp)->prt);
+        nmem_destroy((*rp)->nmem);
         *rp = 0;
     }
 }
index 70d8688..35949c0 100644 (file)
@@ -29,11 +29,12 @@ struct record_cluster;
 struct reclist;
 
 struct relevance *relevance_create_ccl(pp2_charset_fact_t pft,
-                                       NMEM nmem, struct ccl_rpn_node *query);
+                                       struct ccl_rpn_node *query);
 void relevance_destroy(struct relevance **rp);
 void relevance_newrec(struct relevance *r, struct record_cluster *cluster);
 void relevance_countwords(struct relevance *r, struct record_cluster *cluster,
-                          const char *words, int multiplier, const char *name);
+                          const char *words, const char *multiplier,
+                          const char *name);
 void relevance_donerecord(struct relevance *r, struct record_cluster *cluster);
 
 void relevance_prepare_read(struct relevance *rel, struct reclist *rec);
index 64920da..18ba514 100644 (file)
@@ -622,34 +622,64 @@ int session_is_preferred_clients_ready(struct session *s)
     return res == 0;
 }
 
-void session_sort(struct session *se, const char *field, int increasing)
+static void session_clear_set(struct session *se,
+                              const char *sort_field, int increasing)
+{
+    reclist_destroy(se->reclist);
+    se->reclist = 0;
+    if (nmem_total(se->nmem))
+        session_log(se, YLOG_DEBUG, "NMEN operation usage %zd",
+                    nmem_total(se->nmem));
+    nmem_reset(se->nmem);
+    se->total_records = se->total_merged = 0;
+    se->num_termlists = 0;
+    
+    /* reset list of sorted results and clear to relevance search */
+    se->sorted_results = nmem_malloc(se->nmem, sizeof(*se->sorted_results));
+    se->sorted_results->field = nmem_strdup(se->nmem, sort_field);
+    se->sorted_results->increasing = increasing;
+    se->sorted_results->next = 0;
+    
+    se->reclist = reclist_create(se->nmem);
+}
+
+void session_sort(struct session *se, const char *field, int increasing,
+                  int clear_set)
 {
     struct session_sorted_results *sr;
     struct client_list *l;
 
     session_enter(se);
 
-    /* see if we already have sorted for this critieria */
-    for (sr = se->sorted_results; sr; sr = sr->next)
+    yaz_log(YLOG_LOG, "session_sort field=%s", field);
+    if (clear_set)
     {
-        if (!strcmp(field, sr->field) && increasing == sr->increasing)
-            break;
+        session_clear_set(se, field, increasing);
     }
-    if (sr)
+    else
     {
-        session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d already fetched",
-                field, increasing);
-        session_leave(se);
-        return;
+        /* see if we already have sorted for this critieria */
+        for (sr = se->sorted_results; sr; sr = sr->next)
+        {
+            if (!strcmp(field, sr->field) && increasing == sr->increasing)
+                break;
+        }
+        if (sr)
+        {
+            session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d already fetched",
+                        field, increasing);
+            session_leave(se);
+            return;
+        }
+        session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d must fetch",
+                    field, increasing);
+        sr = nmem_malloc(se->nmem, sizeof(*sr));
+        sr->field = nmem_strdup(se->nmem, field);
+        sr->increasing = increasing;
+        sr->next = se->sorted_results;
+        se->sorted_results = sr;
     }
-    session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d must fetch",
-            field, increasing);
-    sr = nmem_malloc(se->nmem, sizeof(*sr));
-    sr->field = nmem_strdup(se->nmem, field);
-    sr->increasing = increasing;
-    sr->next = se->sorted_results;
-    se->sorted_results = sr;
-    
+        
     for (l = se->clients_active; l; l = l->next)
     {
         struct client *cl = l->client;
@@ -688,29 +718,16 @@ enum pazpar2_error_code session_search(struct session *se,
         session_reset_active_clients(se, 0);
     
     session_enter(se);
-    reclist_destroy(se->reclist);
-    se->reclist = 0;
     se->settings_modified = 0;
+    session_clear_set(se, sort_field, increasing);
     relevance_destroy(&se->relevance);
-    if (nmem_total(se->nmem))
-        session_log(se, YLOG_DEBUG, "NMEN operation usage %zd", nmem_total(se->nmem));
-    nmem_reset(se->nmem);
-    se->total_records = se->total_merged = 0;
-    se->num_termlists = 0;
 
-    /* reset list of sorted results and clear to relevance search */
-    se->sorted_results = nmem_malloc(se->nmem, sizeof(*se->sorted_results));
-    se->sorted_results->field = nmem_strdup(se->nmem, sort_field);
-    se->sorted_results->increasing = increasing;
-    se->sorted_results->next = 0;
-    
     live_channels = select_targets(se, filter);
     if (!live_channels)
     {
         session_leave(se);
         return PAZPAR2_NO_TARGETS;
     }
-    se->reclist = reclist_create(se->nmem);
 
     yaz_gettimeofday(&tval);
     
@@ -1795,8 +1812,8 @@ static int ingest_to_cluster(struct client *cl,
             struct record_metadata *rec_md = 0;
             int md_field_id = -1;
             int sk_field_id = -1;
-            int rank = 0;
-            xmlChar *rank_str = 0;
+            const char *rank;
+            xmlChar *xml_rank;
             
             type = xmlGetProp(n, (xmlChar *) "type");
             value = xmlNodeListGetString(xdoc, n->children, 1);
@@ -1811,15 +1828,6 @@ static int ingest_to_cluster(struct client *cl,
             
             ser_md = &service->metadata[md_field_id];
 
-            rank_str = xmlGetProp(n, (xmlChar *) "rank");
-            if (rank_str)
-            {
-                rank = atoi((const char *) rank_str);
-                xmlFree(rank_str);
-            }
-            else
-                rank = ser_md->rank;
-            
             if (ser_md->sortkey_offset >= 0)
             {
                 sk_field_id = ser_md->sortkey_offset;
@@ -1832,6 +1840,9 @@ static int ingest_to_cluster(struct client *cl,
             if (!rec_md)
                 continue;
 
+            xml_rank = xmlGetProp(n, (xmlChar *) "rank");
+            rank = xml_rank ? (const char *) xml_rank : ser_md->rank;
+
             wheretoput = &cluster->metadata[md_field_id];
 
             // and polulate with data:
@@ -1916,7 +1927,6 @@ static int ingest_to_cluster(struct client *cl,
                 }
             }
 
-
             // ranking of _all_ fields enabled ... 
             if (rank)
             {
@@ -1944,6 +1954,8 @@ static int ingest_to_cluster(struct client *cl,
             }
 
             // cleaning up
+            if (xml_rank)
+                xmlFree(xml_rank);
             xmlFree(type);
             xmlFree(value);
             type = value = 0;
index 886f1b6..17d805f 100644 (file)
@@ -156,7 +156,8 @@ void session_destroy(struct session *s);
 void session_init_databases(struct session *s);
 void statistics(struct session *s, struct statistics *stat);
 
-void session_sort(struct session *se, const char *field, int increasing);
+void session_sort(struct session *se, const char *field, int increasing,
+                  int clear_set);
 
 enum pazpar2_error_code session_search(struct session *s, const char *query,
                                        const char *startrecs,
index 24b417f..da39a91 100644 (file)
@@ -22,7 +22,7 @@ EXTRA_DIST = run_pazpar2.sh marc21_test.xsl tmarc.xsl solr-pz2.xsl \
        test_filter.cfg test_filter.urls \
        test_termlist_block.cfg test_termlist_block.urls \
        test_facets_settings_1.xml  test_facets_settings_2.xml \
-       test_url_service.xml  test_url_settings_1.xml  test_url_settings_2.xml  test_url_settings_3.xml  test_url_settings_4.xml \
+       test_url_service.xml test_url_settings.xml \
        test_limit_limitmap.cfg test_limit_limitmap.urls \
        test_limit_limitmap_service.xml \
        test_limit_limitmap_settings_1.xml test_limit_limitmap_settings_2.xml \
index d084f9e..53a0ff0 100644 (file)
@@ -13,7 +13,8 @@
       <metadata name="isbn"/>
       <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"
                termlist="yes"/>
-      <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2" mergekey="optional" />
+      <metadata name="author" brief="yes" termlist="yes" merge="longest"
+                rank="2 au 3" mergekey="optional" /> <!-- rank="2 au 3" -->
       <metadata name="subject" brief="yes" merge="unique" termlist="yes" rank="3"/>
       <metadata name="id"/>
       <metadata name="lccn" merge="unique"/>
index 5da644d..47247d2 100644 (file)
@@ -74,3 +74,6 @@ http://localhost:9763/search.pz2?session=9&command=search&query=computer&limit=M
 http://localhost:9763/search.pz2?session=9&command=show&block=1
 http://localhost:9763/search.pz2?session=9&command=search&query=computer&limit=date%3D1977
 http://localhost:9763/search.pz2?session=9&command=show&block=1
+http://localhost:9763/search.pz2?command=init
+http://localhost:9763/search.pz2?session=10&command=search&query=au%3dadam
+http://localhost:9763/search.pz2?session=10&command=show&block=1
diff --git a/test/test_http_77.res b/test/test_http_77.res
new file mode 100644 (file)
index 0000000..c41b6b8
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>10</session><protocol>1</protocol><keepAlive>50000</keepAlive>
+</init>
\ No newline at end of file
diff --git a/test/test_http_78.res b/test/test_http_78.res
new file mode 100644 (file)
index 0000000..ab63fe6
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<search><status>OK</status></search>
\ No newline at end of file
diff --git a/test/test_http_79.res b/test/test_http_79.res
new file mode 100644 (file)
index 0000000..c4aa933
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>2</merged>
+<total>2</total>
+<start>0</start>
+<num>2</num>
+<hit>
+
+<md-title>The religious teachers of Greece</md-title>
+<md-date>1972</md-date>
+<md-author>Adam, James</md-author>
+<md-subject>Greek literature</md-subject>
+<md-subject>Philosophy, Ancient</md-subject>
+<md-subject>Greece</md-subject>
+<md-description>Reprint of the 1909 ed., which was issued as the 1904-1906 Gifford lectures</md-description><location id="z3950.indexdata.com/marc" name="Index Data MARC test server">
+<md-title>The religious teachers of Greece</md-title>
+<md-date>1972</md-date>
+<md-author>Adam, James</md-author>
+<md-subject>Greek literature</md-subject>
+<md-subject>Philosophy, Ancient</md-subject>
+<md-subject>Greece</md-subject>
+<md-description tag="500">Reprint of the 1909 ed., which was issued as the 1904-1906 Gifford lectures</md-description>
+<md-description tag="504">Includes bibliographical references</md-description>
+<md-test-usersetting>XXXXXXXXXX</md-test-usersetting>
+<md-test-usersetting-2>test-usersetting-2 data: 
+        YYYYYYYYY</md-test-usersetting-2></location>
+<relevance>150000</relevance>
+<recid>content: title the religious teachers of greece author adam james medium book</recid>
+</hit>
+<hit>
+
+<md-title>Four psalms</md-title>
+<md-title-remainder>XXIII, XXXVI, LII, CXXI</md-title-remainder>
+<md-date>1980</md-date>
+<md-author>Smith, George Adam</md-author>
+<md-subject>Bible</md-subject><location id="z3950.indexdata.com/marc" name="Index Data MARC test server">
+<md-title>Four psalms</md-title>
+<md-title-remainder>XXIII, XXXVI, LII, CXXI</md-title-remainder>
+<md-date>1980</md-date>
+<md-author>Smith, George Adam</md-author>
+<md-subject>Bible</md-subject>
+<md-subject>Bible</md-subject>
+<md-subject>Bible</md-subject>
+<md-subject>Bible</md-subject>
+<md-test-usersetting>XXXXXXXXXX</md-test-usersetting>
+<md-test-usersetting-2>test-usersetting-2 data: 
+        YYYYYYYYY</md-test-usersetting-2></location>
+<relevance>100000</relevance>
+<recid>content: title four psalms author smith george adam medium book</recid>
+</hit>
+</show>
\ No newline at end of file
index ef092ea..a3de7ac 100644 (file)
@@ -1,7 +1,7 @@
 http://localhost:9763/search.pz2?command=init&clear=1&pz:elements%5Bmy%5D=F&pz:requestsyntax%5Bmy%5D=usmarc&pz:nativesyntax%5Bmy%5D=iso2709&pz:xslt%5Bmy%5D=marc21_test.xsl&pz:name%5Bmy%5D=marcserver&pz:url%5Bmy%5D=z3950.indexdata.com%2Fmarc
 http://localhost:9763/search.pz2?session=1&command=search&query=computer
 2 http://localhost:9763/search.pz2?session=1&command=show&block=1
-test_url_settings_2.xml http://localhost:9763/search.pz2?session=1&command=settings
+test_url_settings.xml http://localhost:9763/search.pz2?session=1&command=settings
 http://localhost:9763/search.pz2?session=1&command=search&query=the&maxrecs=3
 2 http://localhost:9763/search.pz2?session=1&command=show&block=1
 2 http://localhost:9763/search.pz2?session=1&command=show&block=1&sort=title:1
@@ -12,3 +12,7 @@ http://localhost:9763/search.pz2?command=init&clear=1&pz:elements%5Bmy%5D=F&pz:r
 http://localhost:9763/search.pz2?session=2&command=search&query=fail
 http://localhost:9763/search.pz2?command=init&clear=1&pz:elements%5Bmy%5D=F&pz:requestsyntax%5Bmy%5D=usmarc&pz:nativesyntax%5Bmy%5D=iso2709&pz:xslt%5Bmy%5D=marc21_test.xsl&pz:name%5Bmy%5D=marcserver&pz:url%5Bmy%5D=z3950.indexdata.com%2Fmarc&pz:pqf_strftime%5Bmy%5D=fail+%25%25
 http://localhost:9763/search.pz2?session=3&command=search&query=fail
+test_url_settings.xml http://localhost:9763/search.pz2?session=1&command=settings
+http://localhost:9763/search.pz2?session=1&command=search&query=water
+2 http://localhost:9763/search.pz2?session=1&command=show&block=1&sort=title:1p
+2 http://localhost:9763/search.pz2?session=1&command=show&block=1&sort=date:0p
diff --git a/test/test_url_15.res b/test/test_url_15.res
new file mode 100644 (file)
index 0000000..42534e3
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings><status>OK</status></settings>
\ No newline at end of file
diff --git a/test/test_url_16.res b/test/test_url_16.res
new file mode 100644 (file)
index 0000000..ab63fe6
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<search><status>OK</status></search>
\ No newline at end of file
diff --git a/test/test_url_17.res b/test/test_url_17.res
new file mode 100644 (file)
index 0000000..71647e3
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>10</merged>
+<total>10</total>
+<start>0</start>
+<num>10</num>
+<hit>
+
+<md-title>COAL SAMPLE BANK</md-title>
+<md-description>This data set contains methane data, chemical analysis data, and petrographic analysis data on core samples in Utah</md-description><location id="my" name="marcserver">
+<md-title>COAL SAMPLE BANK</md-title>
+<md-description tag="520">This data set contains methane data, chemical analysis data, and petrographic analysis data on core samples in Utah</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title coal sample bank author medium book</recid>
+</hit>
+<hit>
+
+<md-title>DAM INVENTORY</md-title>
+<md-description>The inventory delineates the following:  dam name, drainage basin, water course, inspection record, safety status, ownership, and other information</md-description><location id="my" name="marcserver">
+<md-title>DAM INVENTORY</md-title>
+<md-description tag="520">The inventory delineates the following:  dam name, drainage basin, water course, inspection record, safety status, ownership, and other information</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title dam inventory author medium book</recid>
+</hit>
+<hit>
+
+<md-title>FRESH WATER WETLANDS MAPS</md-title>
+<md-description>Contained are a series of 1:50,000 scale maps showing regulated and unregulated fresh water wetlands in the organized territories.  Included is a table describing each mapped wetland</md-description><location id="my" name="marcserver">
+<md-title>FRESH WATER WETLANDS MAPS</md-title>
+<md-description tag="520">Contained are a series of 1:50,000 scale maps showing regulated and unregulated fresh water wetlands in the organized territories.  Included is a table describing each mapped wetland</md-description></location>
+<recid>content: title fresh water wetlands maps author medium book</recid>
+</hit>
+<hit>
+
+<md-title>INLAND WETLANDS OF CONNECTICUT</md-title>
+<md-description>This data set contains inland wetlands, as defined by State statute, which are delineated at a scale of 1:12,000, based predominantly on location of wet soils</md-description><location id="my" name="marcserver">
+<md-title>INLAND WETLANDS OF CONNECTICUT</md-title>
+<md-description tag="520">This data set contains inland wetlands, as defined by State statute, which are delineated at a scale of 1:12,000, based predominantly on location of wet soils</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title inland wetlands of connecticut author medium book</recid>
+</hit>
+<hit>
+
+<md-title>MAINE GEOLOGICAL SURVEY BEDROCK WATER WELL INVENTORY</md-title>
+<md-description>This data set contains a series of well inventory maps stored on tape.  The series has no indexing</md-description><location id="my" name="marcserver">
+<md-title>MAINE GEOLOGICAL SURVEY BEDROCK WATER WELL INVENTORY</md-title>
+<md-description tag="520">This data set contains a series of well inventory maps stored on tape.  The series has no indexing</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title maine geological survey bedrock water well inventory author medium book</recid>
+</hit>
+<hit>
+
+<md-title>STATEWIDE PLANNING</md-title>
+<md-description>This data set contains:  1970 digitized land use maps, 1970 digitized zoning maps, active agricultural areas maps (1979-1980), maps displaying current National Flood Insurance Program data, locational guide map of the State Policies Plan for Conservation and Development of Connecticut (1987-1992), 1970 land use statistical data and 1970 municipal zoning data, proposed sewer service areas maps (1978) - DEP has update of this information, water conservation handbooks, and various reports and maps of the areawide Waste Treatment Management Planning Program (208)</md-description><location id="my" name="marcserver">
+<md-title>STATEWIDE PLANNING</md-title>
+<md-description tag="520">This data set contains:  1970 digitized land use maps, 1970 digitized zoning maps, active agricultural areas maps (1979-1980), maps displaying current National Flood Insurance Program data, locational guide map of the State Policies Plan for Conservation and Development of Connecticut (1987-1992), 1970 land use statistical data and 1970 municipal zoning data, proposed sewer service areas maps (1978) - DEP has update of this information, water conservation handbooks, and various reports and maps of the areawide Waste Treatment Management Planning Program (208)</md-description>
+<md-description tag="513">1960-PRESENT</md-description></location>
+<recid>content: title statewide planning author medium book</recid>
+</hit>
+<hit>
+
+<md-title>STREAM CHANNEL ENCROACHMENT LINE STUDIES</md-title>
+<md-description>Detailed engineering studies and large-scale mapping delineating high flow zones for regulation by the State are contained in this data set</md-description><location id="my" name="marcserver">
+<md-title>STREAM CHANNEL ENCROACHMENT LINE STUDIES</md-title>
+<md-description tag="520">Detailed engineering studies and large-scale mapping delineating high flow zones for regulation by the State are contained in this data set</md-description></location>
+<recid>content: title stream channel encroachment line studies author medium book</recid>
+</hit>
+<hit>
+
+<md-title>TIDAL (COASTAL) WETLAND OF CONNECTICUT</md-title>
+<md-description>Tidal wetlands, as defined by State statute, which are delineated by engineering survey at a scale of 1:24,000 comprise this data set</md-description><location id="my" name="marcserver">
+<md-title>TIDAL (COASTAL) WETLAND OF CONNECTICUT</md-title>
+<md-description tag="520">Tidal wetlands, as defined by State statute, which are delineated by engineering survey at a scale of 1:24,000 comprise this data set</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title tidal coastal wetland of connecticut author medium book</recid>
+</hit>
+<hit>
+
+<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
+<md-description>Publications of the Utah Geological and Mineral Survey include reports of investigation, special studies, bulletins, open-file reports, geologic map of Utah, publications of geological societies, geologic and oil and mineral maps, coal monographs, circulars, water resource bulletins, and reprints of articles</md-description><location id="my" name="marcserver">
+<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
+<md-description tag="520">Publications of the Utah Geological and Mineral Survey include reports of investigation, special studies, bulletins, open-file reports, geologic map of Utah, publications of geological societies, geologic and oil and mineral maps, coal monographs, circulars, water resource bulletins, and reprints of articles</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title utah geological and mineral survey publications author medium book</recid>
+</hit>
+<hit>
+
+<md-title>WATER WELL DATA</md-title>
+<md-description>This database contains the following information on water wells in Nevada: driller&apos;s name, owner&apos;s name, location, formations encountered, lithologic descriptions, water level, and water quality</md-description><location id="my" name="marcserver">
+<md-title>WATER WELL DATA</md-title>
+<md-description tag="520">This database contains the following information on water wells in Nevada: driller&apos;s name, owner&apos;s name, location, formations encountered, lithologic descriptions, water level, and water quality</md-description>
+<md-description tag="513">1930-PRESENT</md-description></location>
+<recid>content: title water well data author medium book</recid>
+</hit>
+</show>
\ No newline at end of file
diff --git a/test/test_url_18.res b/test/test_url_18.res
new file mode 100644 (file)
index 0000000..c775894
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>10</merged>
+<total>10</total>
+<start>0</start>
+<num>10</num>
+<hit>
+
+<md-title>STATEWIDE PLANNING</md-title>
+<md-description>This data set contains:  1970 digitized land use maps, 1970 digitized zoning maps, active agricultural areas maps (1979-1980), maps displaying current National Flood Insurance Program data, locational guide map of the State Policies Plan for Conservation and Development of Connecticut (1987-1992), 1970 land use statistical data and 1970 municipal zoning data, proposed sewer service areas maps (1978) - DEP has update of this information, water conservation handbooks, and various reports and maps of the areawide Waste Treatment Management Planning Program (208)</md-description><location id="my" name="marcserver">
+<md-title>STATEWIDE PLANNING</md-title>
+<md-description tag="520">This data set contains:  1970 digitized land use maps, 1970 digitized zoning maps, active agricultural areas maps (1979-1980), maps displaying current National Flood Insurance Program data, locational guide map of the State Policies Plan for Conservation and Development of Connecticut (1987-1992), 1970 land use statistical data and 1970 municipal zoning data, proposed sewer service areas maps (1978) - DEP has update of this information, water conservation handbooks, and various reports and maps of the areawide Waste Treatment Management Planning Program (208)</md-description>
+<md-description tag="513">1960-PRESENT</md-description></location>
+<recid>content: title statewide planning author medium book</recid>
+</hit>
+<hit>
+
+<md-title>WATER WELL DATA</md-title>
+<md-description>This database contains the following information on water wells in Nevada: driller&apos;s name, owner&apos;s name, location, formations encountered, lithologic descriptions, water level, and water quality</md-description><location id="my" name="marcserver">
+<md-title>WATER WELL DATA</md-title>
+<md-description tag="520">This database contains the following information on water wells in Nevada: driller&apos;s name, owner&apos;s name, location, formations encountered, lithologic descriptions, water level, and water quality</md-description>
+<md-description tag="513">1930-PRESENT</md-description></location>
+<recid>content: title water well data author medium book</recid>
+</hit>
+<hit>
+
+<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
+<md-description>Publications of the Utah Geological and Mineral Survey include reports of investigation, special studies, bulletins, open-file reports, geologic map of Utah, publications of geological societies, geologic and oil and mineral maps, coal monographs, circulars, water resource bulletins, and reprints of articles</md-description><location id="my" name="marcserver">
+<md-title>UTAH GEOLOGICAL AND MINERAL SURVEY PUBLICATIONS</md-title>
+<md-description tag="520">Publications of the Utah Geological and Mineral Survey include reports of investigation, special studies, bulletins, open-file reports, geologic map of Utah, publications of geological societies, geologic and oil and mineral maps, coal monographs, circulars, water resource bulletins, and reprints of articles</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title utah geological and mineral survey publications author medium book</recid>
+</hit>
+<hit>
+
+<md-title>COAL SAMPLE BANK</md-title>
+<md-description>This data set contains methane data, chemical analysis data, and petrographic analysis data on core samples in Utah</md-description><location id="my" name="marcserver">
+<md-title>COAL SAMPLE BANK</md-title>
+<md-description tag="520">This data set contains methane data, chemical analysis data, and petrographic analysis data on core samples in Utah</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title coal sample bank author medium book</recid>
+</hit>
+<hit>
+
+<md-title>FRESH WATER WETLANDS MAPS</md-title>
+<md-description>Contained are a series of 1:50,000 scale maps showing regulated and unregulated fresh water wetlands in the organized territories.  Included is a table describing each mapped wetland</md-description><location id="my" name="marcserver">
+<md-title>FRESH WATER WETLANDS MAPS</md-title>
+<md-description tag="520">Contained are a series of 1:50,000 scale maps showing regulated and unregulated fresh water wetlands in the organized territories.  Included is a table describing each mapped wetland</md-description></location>
+<recid>content: title fresh water wetlands maps author medium book</recid>
+</hit>
+<hit>
+
+<md-title>MAINE GEOLOGICAL SURVEY BEDROCK WATER WELL INVENTORY</md-title>
+<md-description>This data set contains a series of well inventory maps stored on tape.  The series has no indexing</md-description><location id="my" name="marcserver">
+<md-title>MAINE GEOLOGICAL SURVEY BEDROCK WATER WELL INVENTORY</md-title>
+<md-description tag="520">This data set contains a series of well inventory maps stored on tape.  The series has no indexing</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title maine geological survey bedrock water well inventory author medium book</recid>
+</hit>
+<hit>
+
+<md-title>INLAND WETLANDS OF CONNECTICUT</md-title>
+<md-description>This data set contains inland wetlands, as defined by State statute, which are delineated at a scale of 1:12,000, based predominantly on location of wet soils</md-description><location id="my" name="marcserver">
+<md-title>INLAND WETLANDS OF CONNECTICUT</md-title>
+<md-description tag="520">This data set contains inland wetlands, as defined by State statute, which are delineated at a scale of 1:12,000, based predominantly on location of wet soils</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title inland wetlands of connecticut author medium book</recid>
+</hit>
+<hit>
+
+<md-title>STREAM CHANNEL ENCROACHMENT LINE STUDIES</md-title>
+<md-description>Detailed engineering studies and large-scale mapping delineating high flow zones for regulation by the State are contained in this data set</md-description><location id="my" name="marcserver">
+<md-title>STREAM CHANNEL ENCROACHMENT LINE STUDIES</md-title>
+<md-description tag="520">Detailed engineering studies and large-scale mapping delineating high flow zones for regulation by the State are contained in this data set</md-description></location>
+<recid>content: title stream channel encroachment line studies author medium book</recid>
+</hit>
+<hit>
+
+<md-title>DAM INVENTORY</md-title>
+<md-description>The inventory delineates the following:  dam name, drainage basin, water course, inspection record, safety status, ownership, and other information</md-description><location id="my" name="marcserver">
+<md-title>DAM INVENTORY</md-title>
+<md-description tag="520">The inventory delineates the following:  dam name, drainage basin, water course, inspection record, safety status, ownership, and other information</md-description>
+<md-description tag="513">-PRESENT</md-description></location>
+<recid>content: title dam inventory author medium book</recid>
+</hit>
+<hit>
+
+<md-title>TIDAL (COASTAL) WETLAND OF CONNECTICUT</md-title>
+<md-description>Tidal wetlands, as defined by State statute, which are delineated by engineering survey at a scale of 1:24,000 comprise this data set</md-description><location id="my" name="marcserver">
+<md-title>TIDAL (COASTAL) WETLAND OF CONNECTICUT</md-title>
+<md-description tag="520">Tidal wetlands, as defined by State statute, which are delineated by engineering survey at a scale of 1:24,000 comprise this data set</md-description>
+<md-description tag="513">1972-PRESENT</md-description></location>
+<recid>content: title tidal coastal wetland of connecticut author medium book</recid>
+</hit>
+</show>
\ No newline at end of file
diff --git a/test/test_url_settings.xml b/test/test_url_settings.xml
new file mode 100644 (file)
index 0000000..f566181
--- /dev/null
@@ -0,0 +1,7 @@
+<!-- Testing URL changing, add sort -->
+<settings target="my">
+  <set name="pz:url"           value="z3950.indexdata.com/gils" />
+  <set name="pz:sortmap:title" value="type7:title" />
+  <set name="pz:sortmap:date" value="z3950:1=1012" />
+</settings>
+
diff --git a/test/test_url_settings_1.xml b/test/test_url_settings_1.xml
deleted file mode 100644 (file)
index ec5b56b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- Testign URL setting -->
-<settings target="my">
-  <set name="pz:name"  value="marcserver" />
-  <set name="pz:url"   value="z3950.indexdata.com/marc" />
-  <set name="pz:nativesyntax" value="iso2709" />
-  <set name="pz:requestsyntax" value="usmarc" />
-  <set name="pz:xslt" value="marc21_test.xsl" />
-  <set name="pz:elements" value="F" />
-</settings>
diff --git a/test/test_url_settings_2.xml b/test/test_url_settings_2.xml
deleted file mode 100644 (file)
index 9835248..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<!-- Testing URL changing, add sort -->
-<settings target="my">
-  <set name="pz:url"           value="z3950.indexdata.com/gils" />
-  <set name="pz:sortmap:title" value="type7:title" />
-</settings>
-
diff --git a/test/test_url_settings_3.xml b/test/test_url_settings_3.xml
deleted file mode 100644 (file)
index e18d45e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- Testign URL setting -->
-<settings target="my">
-  <set name="pz:name"  value="marcserver" />
-  <set name="pz:url"   value="z3950.unknown.indexdata.com/marc" />
-  <set name="pz:nativesyntax" value="iso2709" />
-  <set name="pz:requestsyntax" value="usmarc" />
-  <set name="pz:xslt" value="marc21_test.xsl" />
-  <set name="pz:elements" value="F" />
-</settings>
diff --git a/test/test_url_settings_4.xml b/test/test_url_settings_4.xml
deleted file mode 100644 (file)
index f719eec..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- Testign URL setting -->
-<settings target="my">
-  <set name="pz:name"          value="marcserver" />
-  <set name="pz:url"           value="z3950.indexdata.com/marc" />
-  <set name="pz:nativesyntax"  value="iso2709" />
-  <set name="pz:requestsyntax" value="usmarc" />
-  <set name="pz:xslt"          value="marc21_test.xsl" />
-  <set name="pz:elements"      value="F" />
-  <set name="pz:pqf_strftime"  value="fail %25%25" />
-</settings>
index 8fe0a37..2a41e4b 100644 (file)
@@ -6,7 +6,7 @@
 
   <!-- field-specific mappings -->
   <set name="pz:cclmap:ti" value="u=4 s=al"/>
-  <set name="pz:cclmap:su" value="u=21 s=al"/>
+  <set name="pz:cclmap:au" value="u=1003 s=al"/>
   <set name="pz:cclmap:isbn" value="u=7"/>
   <set name="pz:cclmap:issn" value="u=8"/>
   <set name="pz:cclmap:date" value="u=30 r=r"/>