Towards normalized rankings (PAZ-909)
authorHeikki Levanto <heikki@indexdata.dk>
Tue, 17 Dec 2013 09:34:27 +0000 (10:34 +0100)
committerHeikki Levanto <heikki@indexdata.dk>
Tue, 17 Dec 2013 09:34:27 +0000 (10:34 +0100)
Can extract native ranks, and normalize them (also normalizes
our TF/IDF and position-based pseudorankings to the same level).
Does not yet merge individual record ranks into cluster ranks.
Default behavior should be the same as before.

21 files changed:
src/relevance.c
src/settings.c
src/settings.h
test/test_rank.cfg [new file with mode: 0644]
test/test_rank.sh [new file with mode: 0755]
test/test_rank.urls [new file with mode: 0644]
test/test_rank_1.res [new file with mode: 0644]
test/test_rank_10.res [new file with mode: 0644]
test/test_rank_11.res [new file with mode: 0644]
test/test_rank_12.res [new file with mode: 0644]
test/test_rank_2.res [new file with mode: 0644]
test/test_rank_3.res [new file with mode: 0644]
test/test_rank_4.res [new file with mode: 0644]
test/test_rank_5.res [new file with mode: 0644]
test/test_rank_6.res [new file with mode: 0644]
test/test_rank_7.res [new file with mode: 0644]
test/test_rank_8.res [new file with mode: 0644]
test/test_rank_9.res [new file with mode: 0644]
test/test_rank_settings_1.xml [new file with mode: 0644]
test/test_rank_settings_2.xml [new file with mode: 0644]
test/test_rank_settings_3.xml [new file with mode: 0644]

index 74f0e15..9de591f 100644 (file)
@@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "relevance.h"
 #include "session.h"
+#include "client.h"
+#include "settings.h"
 
 #ifdef WIN32
 #define log2(x) (log(x)/log(2))
@@ -45,6 +47,7 @@ struct relevance
     double lead_decay;
     int length_divide;
     NMEM nmem;
+    struct norm_client *norm;
 };
 
 struct word_entry {
@@ -55,6 +58,222 @@ struct word_entry {
     struct word_entry *next;
 };
 
+// Structure to keep data for norm_client scores from one client
+struct norm_client
+{
+    int num; // number of the client
+    float max;
+    float min;
+    int count;
+    const char *native_score;
+    int scorefield;
+    float a,b; // Rn = a*R + b
+    struct client *client;
+    struct norm_client *next;
+    struct norm_record *records;
+};
+
+const int scorefield_none = -1;  // Do not normalize anything, use tf/idf as is
+  // This is the old behavior, and the default
+const int scorefield_internal = -2;  // use our tf/idf, but normalize it
+const int scorefield_position = -3;  // fake a score based on the position
+
+// A structure for each (sub)record. There is one list for each client
+struct norm_record
+{
+    struct record *record;
+    float score;
+    struct record_cluster *clust;
+    struct norm_record *next;
+};
+
+// Find the norm_client entry for this client, or create one if not there
+struct norm_client *findnorm( struct relevance *rel, struct client* client)
+{
+    struct norm_client *n = rel->norm;
+    struct session_database *sdb;
+    while (n) {
+        if (n->client == client )
+            return n;
+        n = n->next;
+    }
+    n = nmem_malloc(rel->nmem, sizeof(struct norm_client) );
+    if ( rel->norm )
+        n->num = rel->norm->num +1;
+    else
+        n->num = 1;
+    n->count = 0;
+    n->max = 0.0;
+    n->min = 0.0;
+    n->client = client;
+    n->next = rel->norm;
+    rel->norm = n;
+    sdb = client_get_database(client);
+    n->native_score = session_setting_oneval(sdb, PZ_NATIVE_SCORE);
+    n->records = 0;
+    n->scorefield = scorefield_none;
+    yaz_log(YLOG_LOG,"Normalizing: Client %d uses '%s'", n->num, n->native_score );
+    if ( ! n->native_score  || ! *n->native_score )  // not specified
+        n->scorefield = scorefield_none; 
+    else if ( strcmp(n->native_score,"position") == 0 )
+        n->scorefield = scorefield_position;
+    else if ( strcmp(n->native_score,"internal") == 0 )
+        n->scorefield = scorefield_internal;
+    else
+    { // Get the field index for the score
+        struct session *se = client_get_session(client);
+        n->scorefield = conf_service_metadata_field_id(se->service, n->native_score);
+    }
+    yaz_log(YLOG_LOG,"Normalizing: Client %d uses '%s' = %d",
+            n->num, n->native_score, n->scorefield );
+    return n;
+}
+
+
+// Add a record in the list for that client, for normalizing later
+static void setup_norm_record( struct relevance *rel,  struct record_cluster *clust)
+{
+    struct record *record;
+    for (record = clust->records; record; record = record->next)
+    {
+        struct norm_client *norm = findnorm(rel, record->client);
+        struct norm_record *rp;
+        if ( norm->scorefield == scorefield_none)
+            break;  // not interested in normalizing this client
+        rp = nmem_malloc(rel->nmem, sizeof(struct norm_record) );
+        norm->count ++;
+        rp->next = norm->records;
+        norm->records = rp;
+        rp->clust = clust;
+        rp->record = record;
+        if ( norm->scorefield == scorefield_position )
+            rp->score = 1.0 / record->position;
+        else if ( norm->scorefield == scorefield_internal )
+            rp->score = clust->relevance_score; // the tf/idf for the whole cluster
+              // TODO - Get them for each record, merge later!
+        else
+        {
+            struct record_metadata *md = record->metadata[norm->scorefield];
+            rp->score = md->data.fnumber;
+            assert(rp->score>0); // ###
+        }
+        yaz_log(YLOG_LOG,"Got score for %d/%d : %f ",
+                norm->num, record->position, rp->score );
+        if ( norm->count == 1 )
+        {
+            norm->max = rp->score;
+            norm->min = rp->score;
+        } else {
+            if ( rp->score > norm->max )
+                norm->max = rp->score;
+            if ( rp->score < norm->min && abs(rp->score) < 1e-6 )
+                norm->min = rp->score;  // skip zeroes
+        }
+    }
+}
+
+// Calculate the squared sum of residuals, that is the difference from
+// normalized values to the target curve, which is 1/n 
+static double squaresum( struct norm_record *rp, double a, double b)
+{
+    double sum = 0.0;
+    for ( ; rp; rp = rp->next )
+    {
+        double target = 1.0 / rp->record->position;
+        double normscore = rp->score * a + b;
+        double diff = target - normscore;
+        sum += diff * diff;
+    }
+    return sum;
+}
+
+static void normalize_scores(struct relevance *rel)
+{
+    // For each client, normalize scores
+    struct norm_client *norm;
+    for ( norm = rel->norm; norm; norm = norm->next )
+    {
+        yaz_log(YLOG_LOG,"Normalizing client %d: scorefield=%d count=%d",
+                norm->num, norm->scorefield, norm->count);
+        norm->a = 1.0; // default normalizing factors, no change
+        norm->b = 0.0;
+        if ( norm->scorefield != scorefield_none &&
+             norm->scorefield != scorefield_position )
+        { // have something to normalize
+            double range = norm->max - norm->min;
+            int it = 0;
+            double a,b;  // params to optimize
+            double as,bs; // step sizes
+            double chi;
+            // initial guesses for the parameters
+            if ( range < 1e-6 ) // practically zero
+                range = norm->max;
+            a = 1.0 / range;
+            b = abs(norm->min);
+            as = a / 3;
+            bs = b / 3;
+            chi = squaresum( norm->records, a,b);
+            while (it++ < 100)  // safeguard against things not converging
+            {
+                // optimize a
+                double plus = squaresum(norm->records, a+as, b);
+                double minus= squaresum(norm->records, a-as, b);
+                if ( plus < chi && plus < minus )
+                {
+                    a = a + as;
+                    chi = plus;
+                }
+                else if ( minus < chi && minus < plus )
+                {
+                    a = a - as;
+                    chi = minus;
+                }
+                else
+                    as = as / 2;  
+                // optimize b
+                plus = squaresum(norm->records, a, b+bs);
+                minus= squaresum(norm->records, a, b-bs);
+                if ( plus < chi && plus < minus )
+                {
+                    b = b + bs;
+                    chi = plus;
+                }
+                else if ( minus < chi && minus < plus )
+                {
+                    b = b - bs;
+                    chi = minus;
+                }
+                else
+                    bs = bs / 2;
+                yaz_log(YLOG_LOG,"Fitting it=%d: a=%f / %f  b=%f / %f  chi = %f",
+                        it, a, as, b, bs, chi );
+                norm->a = a;
+                norm->b = b;
+                if ( abs(as) * 1000.0 < abs(a) &&
+                     abs(bs) * 1000.0 < abs(b) )
+                    break;  // not changing much any more
+            }
+        }
+        
+        if ( norm->scorefield != scorefield_none )
+        { // distribute the normalized scores to the records
+            struct norm_record *nr = norm->records;
+            for ( ; nr ; nr = nr->next ) {
+                double r = nr->score;
+                r = norm->a * r + norm -> b;
+                nr->clust->relevance_score = 10000 * r;
+                yaz_log(YLOG_LOG,"Normalized %f * %f + %f = %f",
+                        nr->score, norm->a, norm->b, r );
+                // TODO - This keeps overwriting the cluster score in random order!
+                // Need to merge results better
+            }
+
+        }
+
+    } // client loop
+}
+
+
 static struct word_entry *word_entry_match(struct relevance *r,
                                            const char *norm_str,
                                            const char *rank, int *weight)
@@ -290,6 +509,7 @@ struct relevance *relevance_create_ccl(pp2_charset_fact_t pft,
     res->follow_factor = follow_factor;
     res->lead_decay = lead_decay;
     res->length_divide = length_divide;
+    res->norm = 0;
     res->prt = pp2_charset_token_create(pft, "relevance");
 
     pull_terms(res, query);
@@ -360,6 +580,8 @@ void relevance_donerecord(struct relevance *r, struct record_cluster *cluster)
     r->doc_frequency_vec[0]++;
 }
 
+
+
 // Prepare for a relevance-sorted read
 void relevance_prepare_read(struct relevance *rel, struct reclist *reclist)
 {
@@ -367,6 +589,7 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist)
     float *idfvec = xmalloc(rel->vec_len * sizeof(float));
 
     reclist_enter(reclist);
+
     // Calculate document frequency vector for each term.
     for (i = 1; i < rel->vec_len; i++)
     {
@@ -422,9 +645,21 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist)
             wrbuf_printf(w, "score = relevance(%d);\n", relevance);
         }
         rec->relevance_score = relevance;
-    }
+
+        // Build the normalizing structures
+        // List of (sub)records for each target
+        setup_norm_record( rel, rec );
+        
+        // TODO - Loop again, merge individual record scores into clusters
+        // Can I reset the reclist, or can I leave and enter without race conditions?
+        
+    } // cluster loop
+
+    normalize_scores(rel);
+    
     reclist_leave(reclist);
     xfree(idfvec);
+
 }
 
 /*
index 63b8b9b..55f7dc4 100644 (file)
@@ -83,6 +83,7 @@ static char *hard_settings[] = {
     "pz:block_timeout",
     "pz:extendrecs",
     "pz:authentication_mode",
+    "pz:native_score",
     0
 };
 
index 98278c4..0cd2f78 100644 (file)
@@ -56,7 +56,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #define PZ_BLOCK_TIMEOUT        33
 #define PZ_EXTENDRECS           34
 #define PZ_AUTHENTICATION_MODE  35
-#define PZ_MAX_EOF              36
+#define PZ_NATIVE_SCORE         36
+#define PZ_MAX_EOF              37
 
 struct setting
 {
diff --git a/test/test_rank.cfg b/test/test_rank.cfg
new file mode 100644 (file)
index 0000000..d7c6ef8
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+  <!-- Used by test_rank.sh -->
+  <server>
+    <listen port="9763"/>
+    
+    <!-- same as hardcoded rule -->
+    <icu_chain id="facet" locale="en">
+      <transliterate>[[:WhiteSpace:][,.!;]]* } [$] > ;</transliterate>
+    </icu_chain>
+
+    
+    <service>
+      <metadata name="url" merge="unique"/>
+      <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6" mergekey="required" />
+      <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
+      <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="subject" merge="unique" termlist="yes" rank="3"/>
+      <metadata name="id"/>
+      <metadata name="lccn" merge="unique"/>
+      <metadata name="description" brief="yes" merge="longest" rank="3"/>
+
+      <metadata name="medium" brief="yes" merge="longest" mergekey="optional" termlist="yes"/>      
+      <metadata name="score" brief="yes" type="float"/>
+
+      <metadata name="test-usersetting" brief="yes" setting="postproc"/>
+      <metadata name="test" setting="parameter"/>
+      <metadata name="test-usersetting-2" brief="yes"/>      
+      <rank cluster="no"/>
+      <sort-default field="position:1" />
+
+    </service>
+
+  </server>
+
+</pazpar2>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
diff --git a/test/test_rank.sh b/test/test_rank.sh
new file mode 100755 (executable)
index 0000000..3ff2e8b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+TEST=`basename $0 .sh`
+# srcdir might be set by make
+srcdir=${srcdir:-"."}
+
+exec ${srcdir}/run_pazpar2.sh --icu $TEST
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End:
diff --git a/test/test_rank.urls b/test/test_rank.urls
new file mode 100644 (file)
index 0000000..4a8ac44
--- /dev/null
@@ -0,0 +1,12 @@
+http://localhost:9763/search.pz2?session=1&command=init
+test_rank_settings_1.xml http://localhost:9763/search.pz2?session=1&command=settings
+http://localhost:9763/search.pz2?session=1&command=search&query=water&sort=relevance
+2 http://localhost:9763/search.pz2?session=1&command=show&sort=relevance
+http://localhost:9763/search.pz2?session=1&command=init
+test_rank_settings_2.xml http://localhost:9763/search.pz2?session=1&command=settings
+http://localhost:9763/search.pz2?session=1&command=search&query=water&sort=relevance
+2 http://localhost:9763/search.pz2?session=1&command=show&sort=relevance
+http://localhost:9763/search.pz2?session=1&command=init
+test_rank_settings_3.xml http://localhost:9763/search.pz2?session=1&command=settings
+http://localhost:9763/search.pz2?session=1&command=search&query=water&sort=relevance
+2 http://localhost:9763/search.pz2?session=1&command=show&sort=relevance
diff --git a/test/test_rank_1.res b/test/test_rank_1.res
new file mode 100644 (file)
index 0000000..c09ee34
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>1</session><protocol>1</protocol><keepAlive>50000</keepAlive>
+</init>
\ No newline at end of file
diff --git a/test/test_rank_10.res b/test/test_rank_10.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_rank_11.res b/test/test_rank_11.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_rank_12.res b/test/test_rank_12.res
new file mode 100644 (file)
index 0000000..b40a464
--- /dev/null
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>19</merged>
+<total>1995</total>
+<start>0</start>
+<num>19</num>
+<hit>
+ <md-title>Water management problems and challenges in India</md-title>
+ <md-title-remainder>an analytical review</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Dinesh Kumar, M</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1554355631">
+  <md-title>Water management problems and challenges in India</md-title>
+  <md-title-remainder>an analytical review</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Dinesh Kumar, M</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.304635</md-score>
+ </location>
+ <count>1</count>
+ <relevance>2000</relevance>
+ <recid>content: title water management problems and challenges in india author dinesh kumar m medium book</recid>
+</hit>
+<hit>
+ <md-title>The magic of water</md-title>
+ <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Hochschwender, Ted</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3168968100">
+  <md-title>The magic of water</md-title>
+  <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Hochschwender, Ted</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.231453</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1939</relevance>
+ <recid>content: title the magic of water author hochschwender ted medium book</recid>
+</hit>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>1999</md-date>
+ <md-author>De Villiers, Marq</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="488613273">
+  <md-title>Water</md-title>
+  <md-date>1999</md-date>
+  <md-author>De Villiers, Marq</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1902</relevance>
+ <recid>content: title water author de villiers marq medium book</recid>
+</hit>
+<hit>
+ <md-title>Water use for public water supply in Michigan, 1998</md-title>
+ <md-date>2000</md-date>
+ <md-description>&quot;January 3, 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2103225742">
+  <md-title>Water use for public water supply in Michigan, 1998</md-title>
+  <md-date>2000</md-date>
+  <md-description>&quot;January 3, 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1902</relevance>
+ <recid>content: title water use for public water supply in michigan medium book</recid>
+</hit>
+<hit>
+ <md-title>Report to the IUCN on water demand management country study</md-title>
+ <md-title-remainder>Namibia</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3717838211">
+  <md-title>Report to the IUCN on water demand management country study</md-title>
+  <md-title-remainder>Namibia</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-medium>book</md-medium>
+  <md-score>2.114981</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1843</relevance>
+ <recid>content: title report to the iucn on water demand management country study medium book</recid>
+</hit>
+<hit>
+ <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+ <md-title-remainder>final report</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="4266708322">
+  <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+  <md-title-remainder>final report</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title evaluation and control of water pollution in bhavani basin medium book</recid>
+</hit>
+<hit>
+ <md-title>UNSIA Water Cluster</md-title>
+ <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1586353495">
+  <md-title>UNSIA Water Cluster</md-title>
+  <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title unsia water cluster medium book</recid>
+</hit>
+<hit>
+ <md-title>Water and water supplies</md-title>
+ <md-date>1901</md-date>
+ <md-author>Thresh, John Clough</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="520611137">
+  <md-title>Water and water supplies</md-title>
+  <md-date>1901</md-date>
+  <md-author>Thresh, John Clough</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title water and water supplies author thresh john clough medium book</recid>
+</hit>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>2000</md-date>
+ <md-author>Majeed, Abdul</md-author>
+ <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1037483384">
+  <md-title>Water</md-title>
+  <md-date>2000</md-date>
+  <md-author>Majeed, Abdul</md-author>
+  <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title water author majeed abdul medium book</recid>
+</hit>
+<hit>
+ <md-title>Water law</md-title>
+ <md-date>2000</md-date>
+ <md-author>Fisher, D. E</md-author>
+ <md-description>Includes index</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2652095853">
+  <md-title>Water law</md-title>
+  <md-date>2000</md-date>
+  <md-author>Fisher, D. E</md-author>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title water law author fisher d e medium book</recid>
+</hit>
+<hit>
+ <md-title>Water technology management</md-title>
+ <md-date>2001</md-date>
+ <md-description>Collection of articles with reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3200965964">
+  <md-title>Water technology management</md-title>
+  <md-date>2001</md-date>
+  <md-description>Collection of articles with reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1798</relevance>
+ <recid>content: title water technology management medium book</recid>
+</hit>
+<hit>
+ <md-title>Wonderful water</md-title>
+ <md-date>2001</md-date>
+ <md-author>Glover, David</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2135223606">
+  <md-title>Wonderful water</md-title>
+  <md-date>2001</md-date>
+  <md-author>Glover, David</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.037029</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1778</relevance>
+ <recid>content: title wonderful water author glover david medium book</recid>
+</hit>
+<hit>
+ <md-title>A Primer on fresh water</md-title>
+ <md-title-remainder>questions and answers</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2684093717">
+  <md-title>A Primer on fresh water</md-title>
+  <md-title-remainder>questions and answers</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1761</relevance>
+ <recid>content: title a primer on fresh water medium book</recid>
+</hit>
+<hit>
+ <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+ <md-date>1999-2000</md-date>
+ <md-description>&quot;September 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3749836075">
+  <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;September 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1069481248">
+  <md-title>Water quality assessment of the State Water Project, 1998-99</md-title>
+  <md-date>2000</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;July 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>2</count>
+ <relevance>1761</relevance>
+ <recid>content: title water quality assessment of the state water project medium book</recid>
+</hit>
+<hit>
+ <md-title>District water supply plan</md-title>
+ <md-date>2000</md-date>
+ <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="552609001">
+  <md-title>District water supply plan</md-title>
+  <md-date>2000</md-date>
+  <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1688</relevance>
+ <recid>content: title district water supply plan medium book</recid>
+</hit>
+<hit>
+ <md-title>Proposition 13</md-title>
+ <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;March 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3232963828">
+  <md-title>Proposition 13</md-title>
+  <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;March 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1688</relevance>
+ <recid>content: title proposition medium book</recid>
+</hit>
+<hit>
+ <md-title>1999 wastewater and drinking water user charge survey</md-title>
+ <md-date>1999</md-date>
+ <md-description>&quot;December, 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1618351359">
+  <md-title>1999 wastewater and drinking water user charge survey</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;December, 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1688</relevance>
+ <recid>content: title wastewater and drinking water user charge survey medium book</recid>
+</hit>
+<hit>
+ <md-title>Water in press, 1997</md-title>
+ <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>With reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2167221470">
+  <md-title>Water in press, 1997</md-title>
+  <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>Includes index</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1688</relevance>
+ <recid>content: title water in press medium book</recid>
+</hit>
+<hit>
+ <md-title>Who governs water?</md-title>
+ <md-title-remainder>the politics of water resource management</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-author>Frey, Hans</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3738890">
+  <md-title>Who governs water?</md-title>
+  <md-title-remainder>the politics of water resource management</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-author>Frey, Hans</md-author>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1688</relevance>
+ <recid>content: title who governs water author frey hans medium book</recid>
+</hit>
+</show>
\ No newline at end of file
diff --git a/test/test_rank_2.res b/test/test_rank_2.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_rank_3.res b/test/test_rank_3.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_rank_4.res b/test/test_rank_4.res
new file mode 100644 (file)
index 0000000..b9ecd5e
--- /dev/null
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>19</merged>
+<total>1995</total>
+<start>0</start>
+<num>19</num>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>1999</md-date>
+ <md-author>De Villiers, Marq</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="488613273">
+  <md-title>Water</md-title>
+  <md-date>1999</md-date>
+  <md-author>De Villiers, Marq</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>56108</relevance>
+ <recid>content: title water author de villiers marq medium book</recid>
+</hit>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>2000</md-date>
+ <md-author>Majeed, Abdul</md-author>
+ <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1037483384">
+  <md-title>Water</md-title>
+  <md-date>2000</md-date>
+  <md-author>Majeed, Abdul</md-author>
+  <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>48790</relevance>
+ <recid>content: title water author majeed abdul medium book</recid>
+</hit>
+<hit>
+ <md-title>Water law</md-title>
+ <md-date>2000</md-date>
+ <md-author>Fisher, D. E</md-author>
+ <md-description>Includes index</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2652095853">
+  <md-title>Water law</md-title>
+  <md-date>2000</md-date>
+  <md-author>Fisher, D. E</md-author>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>43911</relevance>
+ <recid>content: title water law author fisher d e medium book</recid>
+</hit>
+<hit>
+ <md-title>A Primer on fresh water</md-title>
+ <md-title-remainder>questions and answers</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2684093717">
+  <md-title>A Primer on fresh water</md-title>
+  <md-title-remainder>questions and answers</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>1</count>
+ <relevance>42447</relevance>
+ <recid>content: title a primer on fresh water medium book</recid>
+</hit>
+<hit>
+ <md-title>Water and water supplies</md-title>
+ <md-date>1901</md-date>
+ <md-author>Thresh, John Clough</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="520611137">
+  <md-title>Water and water supplies</md-title>
+  <md-date>1901</md-date>
+  <md-author>Thresh, John Clough</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>36592</relevance>
+ <recid>content: title water and water supplies author thresh john clough medium book</recid>
+</hit>
+<hit>
+ <md-title>Water technology management</md-title>
+ <md-date>2001</md-date>
+ <md-description>Collection of articles with reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3200965964">
+  <md-title>Water technology management</md-title>
+  <md-date>2001</md-date>
+  <md-description>Collection of articles with reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>31713</relevance>
+ <recid>content: title water technology management medium book</recid>
+</hit>
+<hit>
+ <md-title>Wonderful water</md-title>
+ <md-date>2001</md-date>
+ <md-author>Glover, David</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2135223606">
+  <md-title>Wonderful water</md-title>
+  <md-date>2001</md-date>
+  <md-author>Glover, David</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.037029</md-score>
+ </location>
+ <count>1</count>
+ <relevance>29274</relevance>
+ <recid>content: title wonderful water author glover david medium book</recid>
+</hit>
+<hit>
+ <md-title>Water management problems and challenges in India</md-title>
+ <md-title-remainder>an analytical review</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Dinesh Kumar, M</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1554355631">
+  <md-title>Water management problems and challenges in India</md-title>
+  <md-title-remainder>an analytical review</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Dinesh Kumar, M</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.304635</md-score>
+ </location>
+ <count>1</count>
+ <relevance>28577</relevance>
+ <recid>content: title water management problems and challenges in india author dinesh kumar m medium book</recid>
+</hit>
+<hit>
+ <md-title>UNSIA Water Cluster</md-title>
+ <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1586353495">
+  <md-title>UNSIA Water Cluster</md-title>
+  <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>25440</relevance>
+ <recid>content: title unsia water cluster medium book</recid>
+</hit>
+<hit>
+ <md-title>Report to the IUCN on water demand management country study</md-title>
+ <md-title-remainder>Namibia</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3717838211">
+  <md-title>Report to the IUCN on water demand management country study</md-title>
+  <md-title-remainder>Namibia</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-medium>book</md-medium>
+  <md-score>2.114981</md-score>
+ </location>
+ <count>1</count>
+ <relevance>24882</relevance>
+ <recid>content: title report to the iucn on water demand management country study medium book</recid>
+</hit>
+<hit>
+ <md-title>Water use for public water supply in Michigan, 1998</md-title>
+ <md-date>2000</md-date>
+ <md-description>&quot;January 3, 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2103225742">
+  <md-title>Water use for public water supply in Michigan, 1998</md-title>
+  <md-date>2000</md-date>
+  <md-description>&quot;January 3, 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>21955</relevance>
+ <recid>content: title water use for public water supply in michigan medium book</recid>
+</hit>
+<hit>
+ <md-title>Who governs water?</md-title>
+ <md-title-remainder>the politics of water resource management</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-author>Frey, Hans</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3738890">
+  <md-title>Who governs water?</md-title>
+  <md-title-remainder>the politics of water resource management</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-author>Frey, Hans</md-author>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>21142</relevance>
+ <recid>content: title who governs water author frey hans medium book</recid>
+</hit>
+<hit>
+ <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+ <md-title-remainder>final report</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="4266708322">
+  <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+  <md-title-remainder>final report</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>20817</relevance>
+ <recid>content: title evaluation and control of water pollution in bhavani basin medium book</recid>
+</hit>
+<hit>
+ <md-title>District water supply plan</md-title>
+ <md-date>2000</md-date>
+ <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="552609001">
+  <md-title>District water supply plan</md-title>
+  <md-date>2000</md-date>
+  <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>19516</relevance>
+ <recid>content: title district water supply plan medium book</recid>
+</hit>
+<hit>
+ <md-title>1999 wastewater and drinking water user charge survey</md-title>
+ <md-date>1999</md-date>
+ <md-description>&quot;December, 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1618351359">
+  <md-title>1999 wastewater and drinking water user charge survey</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;December, 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>18819</relevance>
+ <recid>content: title wastewater and drinking water user charge survey medium book</recid>
+</hit>
+<hit>
+ <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+ <md-date>1999-2000</md-date>
+ <md-description>&quot;September 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3749836075">
+  <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;September 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1069481248">
+  <md-title>Water quality assessment of the State Water Project, 1998-99</md-title>
+  <md-date>2000</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;July 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>2</count>
+ <relevance>18296</relevance>
+ <recid>content: title water quality assessment of the state water project medium book</recid>
+</hit>
+<hit>
+ <md-title>Water in press, 1997</md-title>
+ <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>With reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2167221470">
+  <md-title>Water in press, 1997</md-title>
+  <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>Includes index</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>16513</relevance>
+ <recid>content: title water in press medium book</recid>
+</hit>
+<hit>
+ <md-title>The magic of water</md-title>
+ <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Hochschwender, Ted</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3168968100">
+  <md-title>The magic of water</md-title>
+  <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Hochschwender, Ted</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.231453</md-score>
+ </location>
+ <count>1</count>
+ <relevance>15246</relevance>
+ <recid>content: title the magic of water author hochschwender ted medium book</recid>
+</hit>
+<hit>
+ <md-title>Proposition 13</md-title>
+ <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;March 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3232963828">
+  <md-title>Proposition 13</md-title>
+  <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;March 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>11753</relevance>
+ <recid>content: title proposition medium book</recid>
+</hit>
+</show>
\ No newline at end of file
diff --git a/test/test_rank_5.res b/test/test_rank_5.res
new file mode 100644 (file)
index 0000000..fb142f0
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>2</session><protocol>1</protocol><keepAlive>50000</keepAlive>
+</init>
\ No newline at end of file
diff --git a/test/test_rank_6.res b/test/test_rank_6.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_rank_7.res b/test/test_rank_7.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_rank_8.res b/test/test_rank_8.res
new file mode 100644 (file)
index 0000000..35002b0
--- /dev/null
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>19</merged>
+<total>1995</total>
+<start>0</start>
+<num>19</num>
+<hit>
+ <md-title>Water management problems and challenges in India</md-title>
+ <md-title-remainder>an analytical review</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Dinesh Kumar, M</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1554355631">
+  <md-title>Water management problems and challenges in India</md-title>
+  <md-title-remainder>an analytical review</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Dinesh Kumar, M</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.304635</md-score>
+ </location>
+ <count>1</count>
+ <relevance>10000</relevance>
+ <recid>content: title water management problems and challenges in india author dinesh kumar m medium book</recid>
+</hit>
+<hit>
+ <md-title>The magic of water</md-title>
+ <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-author>Hochschwender, Ted</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3168968100">
+  <md-title>The magic of water</md-title>
+  <md-title-remainder>reflection and transparency at the water&apos;s edge</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-author>Hochschwender, Ted</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.231453</md-score>
+ </location>
+ <count>1</count>
+ <relevance>5000</relevance>
+ <recid>content: title the magic of water author hochschwender ted medium book</recid>
+</hit>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>1999</md-date>
+ <md-author>De Villiers, Marq</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="488613273">
+  <md-title>Water</md-title>
+  <md-date>1999</md-date>
+  <md-author>De Villiers, Marq</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>3333</relevance>
+ <recid>content: title water author de villiers marq medium book</recid>
+</hit>
+<hit>
+ <md-title>Water use for public water supply in Michigan, 1998</md-title>
+ <md-date>2000</md-date>
+ <md-description>&quot;January 3, 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2103225742">
+  <md-title>Water use for public water supply in Michigan, 1998</md-title>
+  <md-date>2000</md-date>
+  <md-description>&quot;January 3, 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.186368</md-score>
+ </location>
+ <count>1</count>
+ <relevance>2500</relevance>
+ <recid>content: title water use for public water supply in michigan medium book</recid>
+</hit>
+<hit>
+ <md-title>Report to the IUCN on water demand management country study</md-title>
+ <md-title-remainder>Namibia</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3717838211">
+  <md-title>Report to the IUCN on water demand management country study</md-title>
+  <md-title-remainder>Namibia</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-medium>book</md-medium>
+  <md-score>2.114981</md-score>
+ </location>
+ <count>1</count>
+ <relevance>2000</relevance>
+ <recid>content: title report to the iucn on water demand management country study medium book</recid>
+</hit>
+<hit>
+ <md-title>Water</md-title>
+ <md-date>2000</md-date>
+ <md-author>Majeed, Abdul</md-author>
+ <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1037483384">
+  <md-title>Water</md-title>
+  <md-date>2000</md-date>
+  <md-author>Majeed, Abdul</md-author>
+  <md-description>&quot;Balochistan conservation strategy background paper&quot;--T.p</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1666</relevance>
+ <recid>content: title water author majeed abdul medium book</recid>
+</hit>
+<hit>
+ <md-title>Water law</md-title>
+ <md-date>2000</md-date>
+ <md-author>Fisher, D. E</md-author>
+ <md-description>Includes index</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2652095853">
+  <md-title>Water law</md-title>
+  <md-date>2000</md-date>
+  <md-author>Fisher, D. E</md-author>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1428</relevance>
+ <recid>content: title water law author fisher d e medium book</recid>
+</hit>
+<hit>
+ <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+ <md-title-remainder>final report</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="4266708322">
+  <md-title>Evaluation and control of water pollution in Bhavani Basin</md-title>
+  <md-title-remainder>final report</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>&quot;Funded by Institute for water Studies, Water Resources Organisation (PWD).&quot;</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1250</relevance>
+ <recid>content: title evaluation and control of water pollution in bhavani basin medium book</recid>
+</hit>
+<hit>
+ <md-title>UNSIA Water Cluster</md-title>
+ <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1586353495">
+  <md-title>UNSIA Water Cluster</md-title>
+  <md-title-remainder>priorities and strategies for water in Africa</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;United Nations System-wide Initiative on Africa (UNSIA).&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1111</relevance>
+ <recid>content: title unsia water cluster medium book</recid>
+</hit>
+<hit>
+ <md-title>Water technology management</md-title>
+ <md-date>2001</md-date>
+ <md-description>Collection of articles with reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3200965964">
+  <md-title>Water technology management</md-title>
+  <md-date>2001</md-date>
+  <md-description>Collection of articles with reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>1000</relevance>
+ <recid>content: title water technology management medium book</recid>
+</hit>
+<hit>
+ <md-title>Water and water supplies</md-title>
+ <md-date>1901</md-date>
+ <md-author>Thresh, John Clough</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="520611137">
+  <md-title>Water and water supplies</md-title>
+  <md-date>1901</md-date>
+  <md-author>Thresh, John Clough</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.061328</md-score>
+ </location>
+ <count>1</count>
+ <relevance>909</relevance>
+ <recid>content: title water and water supplies author thresh john clough medium book</recid>
+</hit>
+<hit>
+ <md-title>Wonderful water</md-title>
+ <md-date>2001</md-date>
+ <md-author>Glover, David</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2135223606">
+  <md-title>Wonderful water</md-title>
+  <md-date>2001</md-date>
+  <md-author>Glover, David</md-author>
+  <md-medium>book</md-medium>
+  <md-score>2.037029</md-score>
+ </location>
+ <count>1</count>
+ <relevance>833</relevance>
+ <recid>content: title wonderful water author glover david medium book</recid>
+</hit>
+<hit>
+ <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+ <md-date>1999-2000</md-date>
+ <md-description>&quot;September 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3749836075">
+  <md-title>Water quality assessment of the State Water Project, 1996-97</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;September 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1069481248">
+  <md-title>Water quality assessment of the State Water Project, 1998-99</md-title>
+  <md-date>2000</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;July 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>2</count>
+ <relevance>769</relevance>
+ <recid>content: title water quality assessment of the state water project medium book</recid>
+</hit>
+<hit>
+ <md-title>A Primer on fresh water</md-title>
+ <md-title-remainder>questions and answers</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2684093717">
+  <md-title>A Primer on fresh water</md-title>
+  <md-title-remainder>questions and answers</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>Issued also in French under title: Notions élémentaires sur l&apos;eau douce : questions et réponses</md-description>
+  <md-description>Includes index</md-description>
+  <md-medium>book</md-medium>
+  <md-score>2.016555</md-score>
+ </location>
+ <count>1</count>
+ <relevance>666</relevance>
+ <recid>content: title a primer on fresh water medium book</recid>
+</hit>
+<hit>
+ <md-title>Who governs water?</md-title>
+ <md-title-remainder>the politics of water resource management</md-title-remainder>
+ <md-date>1999</md-date>
+ <md-author>Frey, Hans</md-author>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3738890">
+  <md-title>Who governs water?</md-title>
+  <md-title-remainder>the politics of water resource management</md-title-remainder>
+  <md-date>1999</md-date>
+  <md-author>Frey, Hans</md-author>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>625</relevance>
+ <recid>content: title who governs water author frey hans medium book</recid>
+</hit>
+<hit>
+ <md-title>1999 wastewater and drinking water user charge survey</md-title>
+ <md-date>1999</md-date>
+ <md-description>&quot;December, 1999.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="1618351359">
+  <md-title>1999 wastewater and drinking water user charge survey</md-title>
+  <md-date>1999</md-date>
+  <md-description>Cover title</md-description>
+  <md-description>&quot;December, 1999.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>588</relevance>
+ <recid>content: title wastewater and drinking water user charge survey medium book</recid>
+</hit>
+<hit>
+ <md-title>Proposition 13</md-title>
+ <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+ <md-date>2000</md-date>
+ <md-description>&quot;March 2000.&quot;</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="3232963828">
+  <md-title>Proposition 13</md-title>
+  <md-title-remainder>Safe Drinking Water, Clean Water, Watershed Protection, and Flood Protection Act</md-title-remainder>
+  <md-date>2000</md-date>
+  <md-description>&quot;March 2000.&quot;</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>555</relevance>
+ <recid>content: title proposition medium book</recid>
+</hit>
+<hit>
+ <md-title>District water supply plan</md-title>
+ <md-date>2000</md-date>
+ <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="552609001">
+  <md-title>District water supply plan</md-title>
+  <md-date>2000</md-date>
+  <md-description>[1] [No special title] -- [2] Appendixes</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>526</relevance>
+ <recid>content: title district water supply plan medium book</recid>
+</hit>
+<hit>
+ <md-title>Water in press, 1997</md-title>
+ <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+ <md-date>1998</md-date>
+ <md-description>With reference to India</md-description>
+ <md-medium>book</md-medium>
+ <location id="LOC Solr Test"
+    name="LOC Solr Test" checksum="2167221470">
+  <md-title>Water in press, 1997</md-title>
+  <md-title-remainder>an index of news items on water resources selected from leading news papers</md-title-remainder>
+  <md-date>1998</md-date>
+  <md-description>Includes index</md-description>
+  <md-description>With reference to India</md-description>
+  <md-medium>book</md-medium>
+  <md-score>1.928196</md-score>
+ </location>
+ <count>1</count>
+ <relevance>500</relevance>
+ <recid>content: title water in press medium book</recid>
+</hit>
+</show>
\ No newline at end of file
diff --git a/test/test_rank_9.res b/test/test_rank_9.res
new file mode 100644 (file)
index 0000000..ef5625a
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>3</session><protocol>1</protocol><keepAlive>50000</keepAlive>
+</init>
\ No newline at end of file
diff --git a/test/test_rank_settings_1.xml b/test/test_rank_settings_1.xml
new file mode 100644 (file)
index 0000000..6ca8973
--- /dev/null
@@ -0,0 +1,40 @@
+<!-- Solr target -->
+<settings target="LOC Solr Test">
+  <set name="pz:name"  value="LOC Solr Test" />
+  <set name="pz:url"   value="ocs-test.indexdata.com/solr/select" />
+
+  <set name="pz:limitmap:author"  value="rpn:@attr 1=author_exact 6=3" />
+  <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:medium"  value="rpn:@attr 1=medium_exact @attr 6=3" />
+
+  <!-- no native_score, the default behavior -->
+  
+  <set name="full_text_target"  value="=NO" />
+  <set name="use_url_proxy"  value="0" />
+  <set name="pz:piggyback"   value="1" />
+  <set name="pz:preferred"   value="1" />
+  <set name="pz:block_timeout"  value="2" />
+  <set name="pz:cclmap:term"  value="1=text s=Dal" />
+  <set name="pz:cclmap:au"    value="1=author"   />
+  <set name="pz:cclmap:su"    value="1=subject"  />
+  <set name="pz:cclmap:date"  value="1=date" />
+<!--
+  <set name="pz:cclmap:issn"  value="1=issn" />
+-->
+  <set name="pz:cclmap:ti"  value="1=title" />
+  <set name="pz:cclmap:isbn"  value="1=isbn" />
+  <set name="pz:cclmap:author_phrase" value="1=author_exact 6=3"/>
+  <set name="pz:sru"         value="solr"  />
+  <set name="pz:xslt"  value="solr-pz2.xsl" />
+  <set name="use_thumbnails" value="0" />
+  <set name="pz:queryencoding"  value="UTF-8" />
+  <set name="pz:extra_args"  value="fl=*,score" />
+  <set name="pz:termlist_term_count" value="10"/>
+  <set name="pz:facetmap:author"  value="author_exact"  />
+  <set name="pz:facetmap:subject" value="subject_exact" />
+  <set name="pz:facetmap:medium"  value="medium_exact"  />
+  <set name="pz:facetmap:date"  value="date" />
+  <set name="pz:maxrecs" value="20" />
+  <set name="pz:present_chunk" value="0"/>
+</settings>
diff --git a/test/test_rank_settings_2.xml b/test/test_rank_settings_2.xml
new file mode 100644 (file)
index 0000000..a003e95
--- /dev/null
@@ -0,0 +1,33 @@
+<!-- Solr target -->
+<settings target="LOC Solr Test">
+  <set name="pz:name"  value="LOC Solr Test" />
+  <set name="pz:url"   value="ocs-test.indexdata.com/solr/select" />
+
+  <set name="pz:native_score"  value="position" />
+  
+  <set name="full_text_target"  value="=NO" />
+  <set name="use_url_proxy"  value="0" />
+  <set name="pz:piggyback"   value="1" />
+  <set name="pz:preferred"   value="1" />
+  <set name="pz:block_timeout"  value="2" />
+
+  <set name="pz:cclmap:term"  value="1=text s=Dal" />
+  <set name="pz:cclmap:au"    value="1=author"   />
+  <set name="pz:cclmap:su"    value="1=subject"  />
+  <set name="pz:cclmap:date"  value="1=date" />
+  <set name="pz:cclmap:ti"  value="1=title" />
+  <set name="pz:cclmap:isbn"  value="1=isbn" />
+  <set name="pz:cclmap:author_phrase" value="1=author_exact 6=3"/>
+  <set name="pz:sru"         value="solr"  />
+  <set name="pz:xslt"  value="solr-pz2.xsl" />
+  <set name="use_thumbnails" value="0" />
+  <set name="pz:queryencoding"  value="UTF-8" />
+  <set name="pz:extra_args"  value="fl=*,score" />
+  <set name="pz:termlist_term_count" value="10"/>
+  <set name="pz:facetmap:author"  value="author_exact"  />
+  <set name="pz:facetmap:subject" value="subject_exact" />
+  <set name="pz:facetmap:medium"  value="medium_exact"  />
+  <set name="pz:facetmap:date"  value="date" />
+  <set name="pz:maxrecs" value="20" />
+  <set name="pz:present_chunk" value="0"/>
+</settings>
diff --git a/test/test_rank_settings_3.xml b/test/test_rank_settings_3.xml
new file mode 100644 (file)
index 0000000..3f51f26
--- /dev/null
@@ -0,0 +1,33 @@
+<!-- Solr target -->
+<settings target="LOC Solr Test">
+  <set name="pz:name"  value="LOC Solr Test" />
+  <set name="pz:url"   value="ocs-test.indexdata.com/solr/select" />
+
+  <set name="pz:native_score"  value="score" />
+  
+  <set name="full_text_target"  value="=NO" />
+  <set name="use_url_proxy"  value="0" />
+  <set name="pz:piggyback"   value="1" />
+  <set name="pz:preferred"   value="1" />
+  <set name="pz:block_timeout"  value="2" />
+
+  <set name="pz:cclmap:term"  value="1=text s=Dal" />
+  <set name="pz:cclmap:au"    value="1=author"   />
+  <set name="pz:cclmap:su"    value="1=subject"  />
+  <set name="pz:cclmap:date"  value="1=date" />
+  <set name="pz:cclmap:ti"  value="1=title" />
+  <set name="pz:cclmap:isbn"  value="1=isbn" />
+  <set name="pz:cclmap:author_phrase" value="1=author_exact 6=3"/>
+  <set name="pz:sru"         value="solr"  />
+  <set name="pz:xslt"  value="solr-pz2.xsl" />
+  <set name="use_thumbnails" value="0" />
+  <set name="pz:queryencoding"  value="UTF-8" />
+  <set name="pz:extra_args"  value="fl=*,score" />
+  <set name="pz:termlist_term_count" value="10"/>
+  <set name="pz:facetmap:author"  value="author_exact"  />
+  <set name="pz:facetmap:subject" value="subject_exact" />
+  <set name="pz:facetmap:medium"  value="medium_exact"  />
+  <set name="pz:facetmap:date"  value="date" />
+  <set name="pz:maxrecs" value="20" />
+  <set name="pz:present_chunk" value="0"/>
+</settings>