Only reseting on position, when not done before. Otherwise it would reset on every...
authorDennis Schafroth <dennis@indexdata.com>
Wed, 22 Aug 2012 14:32:15 +0000 (16:32 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 22 Aug 2012 14:37:58 +0000 (16:37 +0200)
NEWS
src/client.c
src/http_command.c
src/session.c
src/session.h
test/test_limit_limitmap.urls
test/test_limit_limitmap_31.res
test/test_limit_limitmap_settings_1.xml
test/test_limit_limitmap_settings_2.xml

diff --git a/NEWS b/NEWS
index 5a42626..cc97672 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+--- 1.6.16 2012/08/22
+
+Revert the changes introduce in 1.6.15 around the position sorting. It resetted the 
+resultset and sorting when the sort order is position. However this will be done on
+every client poll, which will make pazpar2 continuing reset and fetching. 
+It should only be done on FIRST request where the sort order change. 
+
+Fix an issue on suggestions: Also disable suggestions on empty string. 
+
+Clean up in turbo marc stylesheet. 
+
+Remove the hardcoded size of termlists.
+
 --- 1.6.15 2012/06/27
 
 New facility: ccldirective may be given in service definition. Allows
index 307203e..ba9bab4 100644 (file)
@@ -691,7 +691,7 @@ static void client_set_facets_request(struct client *cl, ZOOM_connection link)
                 wrbuf_puts(w, ",");
         }
     }
-    yaz_log(YLOG_LOG, "using facets str: %s", wrbuf_cstr(w));
+    yaz_log(YLOG_DEBUG, "using facets str: %s", wrbuf_cstr(w));
     ZOOM_connection_option_set(link, "facets",
                                wrbuf_len(w) ? wrbuf_cstr(w) : 0);
     wrbuf_destroy(w);
@@ -1429,11 +1429,11 @@ struct suggestions* client_suggestions_create(const char* suggestions_string)
     int i;
     NMEM nmem;
     struct suggestions *suggestions;
-    if (suggestions_string == 0)
+    if (suggestions_string == 0 || suggestions_string[0] == 0 )
         return 0;
     nmem = nmem_create();
     suggestions = nmem_malloc(nmem, sizeof(*suggestions));
-    yaz_log(YLOG_DEBUG, "client target suggestions: %s", suggestions_string);
+    yaz_log(YLOG_DEBUG, "client target suggestions: %s.", suggestions_string);
 
     suggestions->nmem = nmem;
     suggestions->num = 0;
index aa73f91..7676eef 100644 (file)
@@ -1188,8 +1188,9 @@ static void cmd_show(struct http_channel *c)
         release_session(c, s);
         return;
     }
-    session_sort(s->psession, sp->name, sp->increasing,
-                 sp->type == Metadata_sortkey_position);
+    session_sort(s->psession, sp->name, sp->increasing, sp->type == Metadata_sortkey_position);
+                 /* TODO This was too simple. Will make pazpar2 continuing reseting the session resultset and redo the search. Disable this for now
+                    sp->type == Metadata_sortkey_position */
 
     status = session_active_clients(s->psession);
 
index 008a617..6ac2276 100644 (file)
@@ -651,6 +651,7 @@ void session_sort(struct session *se, const char *field, int increasing,
 
     yaz_log(YLOG_LOG, "session_sort field=%s increasing=%d position=%d", field, increasing, position);
     /* see if we already have sorted for this critieria */
+    /* TODO I do not see the point in saving all previous sorts. Dont we re-sort anyway ? */
     for (sr = se->sorted_results; sr; sr = sr->next)
     {
         if (!strcmp(field, sr->field) && increasing == sr->increasing && sr->position == position)
@@ -658,7 +659,7 @@ void session_sort(struct session *se, const char *field, int increasing,
     }
     if (sr)
     {
-        z(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d position=%d already fetched",
+        session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d position=%d already fetched",
                     field, increasing, position);
         session_leave(se);
         return;
@@ -668,8 +669,8 @@ void session_sort(struct session *se, const char *field, int increasing,
         session_clear_set(se, field, increasing, position);
     }
 
-    session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d must fetch",
-                field, increasing);
+    session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d position=%d must fetch",
+                field, increasing, position);
     sr = nmem_malloc(se->nmem, sizeof(*sr));
     sr->field = nmem_strdup(se->nmem, field);
     sr->increasing = increasing;
@@ -695,7 +696,8 @@ enum pazpar2_error_code session_search(struct session *se,
                                        const char *filter,
                                        const char *limit,
                                        const char **addinfo,
-                                       const char *sort_field, int increasing)
+                                       const char *sort_field,
+                                       int increasing)
 {
     int live_channels = 0;
     int no_working = 0;
@@ -716,7 +718,7 @@ enum pazpar2_error_code session_search(struct session *se,
     
     session_enter(se);
     se->settings_modified = 0;
-    session_clear_set(se, sort_field, increasing);
+    session_clear_set(se, sort_field, increasing, 0); /* hardcoded position */
     relevance_destroy(&se->relevance);
 
     live_channels = select_targets(se, filter);
index 3e5b6c4..ea2cb01 100644 (file)
@@ -156,8 +156,7 @@ 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,
-                  int clear_set);
+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 a56d6c1..4e03d25 100644 (file)
@@ -6,7 +6,7 @@ http://localhost:9763/search.pz2?session=1&command=bytarget
 http://localhost:9763/search.pz2?session=1&command=termlist&block=1&name=xtargets%2Cauthor%2Csubject%2Cdate
 test_limit_limitmap_settings_2.xml http://localhost:9763/search.pz2?session=1&command=settings
 http://localhost:9763/search.pz2?session=1&command=search&query=computer
-4 http://localhost:9763/search.pz2?session=1&command=show&block=1
+10 http://localhost:9763/search.pz2?session=1&command=show&block=1
 http://localhost:9763/search.pz2?session=1&command=bytarget
 http://localhost:9763/search.pz2?session=1&command=termlist&block=1&name=xtargets%2Cauthor%2Csubject%2Cdate
 http://localhost:9763/search.pz2?session=1&command=termlist&block=1&report=status&name=xtargets%2Cauthor%2Csubject%2Cdate
@@ -28,4 +28,16 @@ http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=M
 1 http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
 http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977
 http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3C1977
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977-1997
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3C1977
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
 http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977-1997
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
index 49ad793..3acc441 100644 (file)
@@ -20,9 +20,6 @@
 <id>Target-1</id>
 <name>ztest-db1</name>
 <frequency>10</frequency>
-<approximation>4</approximation>
-<records>4</records>
-<filtered>6</filtered>
 <state>Client_Idle</state>
 <diagnostic>0</diagnostic>
 </term>
index fe94c47..deaa865 100644 (file)
@@ -12,6 +12,7 @@
   <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"/>
+  <set name="pz:cclmap:date_exact" value="u=30 6=3 r=r"/>
   <set name="pz:cclmap:au" value="u=1003"/>
 
   <!-- Retrieval settings -->
index 4fbbdf2..656062a 100644 (file)
@@ -5,7 +5,7 @@
 
   <set name="pz:limitmap:author"  value="ccl:author_phrase" />
   <set name="pz:limitmap:subject" value="rpn:@attr 1=subject_exact" />
-  <set name="pz:limitmap:date"    value="rpn:@attr 1=date @attr 6=3" />
+  <set name="pz:limitmap:date"    value="ccl:date_exact" />
   <set name="pz:limitmap:medium"  value="rpn:@attr 1=medium_exact @attr 6=3" />
 
   <set name="full_text_target"  value="=NO" />
   <set name="pz:cclmap:ti"  value="1=title" />
   <set name="pz:cclmap:au"  value="1=author" />
   <set name="pz:cclmap:author_phrase" value="1=author_exact 6=3"/>
-  <set name="pz:xslt"  value="solr-pz2.xsl" />
   <set name="pz:cclmap:term"  value="1=text s=Dal" />
   <set name="pz:cclmap:isbn"  value="1=isbn" />
+  <set name="pz:cclmap:date_exact"  value="1=date_exact r=r" />
+  <set name="pz:xslt"  value="solr-pz2.xsl" />
   <set name="pz:queryencoding"  value="UTF-8" />
 
 </settings>