Merge branch 'spell-check'
authorDennis Schafroth <dennis@indexdata.com>
Tue, 1 Nov 2011 13:00:40 +0000 (14:00 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Tue, 1 Nov 2011 13:00:40 +0000 (14:00 +0100)
14 files changed:
NEWS
configure.ac
debian/control
pazpar2.spec
src/http_command.c
test/test_solr_spell.cfg [new file with mode: 0644]
test/test_solr_spell.sh [new file with mode: 0755]
test/test_solr_spell.urls [new file with mode: 0644]
test/test_solr_spell_1.res [new file with mode: 0644]
test/test_solr_spell_2.res [new file with mode: 0644]
test/test_solr_spell_3.res [new file with mode: 0644]
test/test_solr_spell_4.res [new file with mode: 0644]
test/test_solr_spell_5.res [new file with mode: 0644]
test/test_solr_spell_6.res [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 85a09f4..d818d3f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+--- 1.6.5 2011/11/01
+Updated bytarget command to contain a suggestions element with misspelled
+words and suggestions to these. pz2.js has been updated to deliver this 
+onwards as well. Only target that currently delivers this is the solr 
+client in YAZ 4.2.18. 
+
 --- 1.6.4 2011/10/28
 
 New service definition element, xslt, that allows an embedded stylesheet
index 0155115..2580281 100644 (file)
@@ -5,7 +5,7 @@
 
 # Autoconf and automake setup
 AC_PREREQ(2.60)
-AC_INIT([pazpar2],[1.6.4],[pazpar2-help@indexdata.dk])
+AC_INIT([pazpar2],[1.6.5],[pazpar2-help@indexdata.dk])
 
 AC_CONFIG_HEADERS(src/config.h)
 
@@ -22,7 +22,7 @@ AC_LANG(C)
 
 AC_C_INLINE
 
-YAZ_INIT([static icu],[4.2.17])
+YAZ_INIT([static icu],[4.2.18])
 if test -z "$YAZLIB"; then
        AC_MSG_ERROR([YAZ development libraries missing])
 fi
index 1e8ef4a..21e3fd7 100644 (file)
@@ -4,7 +4,7 @@ Priority: extra
 Maintainer: Adam Dickmeiss <adam@indexdata.dk>
 Build-Depends: debhelper (>= 5),
        autotools-dev,
-       libyaz4-dev (>= 4.2.17),
+       libyaz4-dev (>= 4.2.18),
        docbook-xsl,
        libgnutls-dev
 Standards-Version: 3.7.2
index 580d410..e65dc44 100644 (file)
@@ -1,17 +1,17 @@
 Summary: Metasearcher
 Name: pazpar2
-Version: 1.6.4
+Version: 1.6.5
 Release: 1indexdata
 License: GPL
 Group: Applications/Internet
 Vendor: Index Data ApS <info@indexdata.dk>
 Source: pazpar2-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libyaz4-devel >= 4.2.17
+BuildRequires: libyaz4-devel >= 4.2.18
 Packager: Adam Dickmeiss <adam@indexdata.dk>
 URL: http://www.indexdata.com/pazpar2
 Summary: pazpar2 daemon
-Requires: libyaz4 >= 4.2.17
+Requires: libyaz4 >= 4.2.18
 
 %description
 Pazpar2 is a high-performance, user interface-independent, data
index 587c908..a86aabb 100644 (file)
@@ -642,8 +642,11 @@ static void cmd_bytarget(struct http_channel *c)
             wrbuf_puts(c->wrbuf, ht[i].settings_xml);
             wrbuf_puts(c->wrbuf, "</settings>\n");
         }
-        if (ht[i].suggestions_xml)
+        if (ht[i].suggestions_xml && ht[i].suggestions_xml[0]) {
+            wrbuf_puts(c->wrbuf, "<suggestions>");
             wrbuf_puts(c->wrbuf, ht[i].suggestions_xml);
+            wrbuf_puts(c->wrbuf, "</suggestions>");
+        }
         wrbuf_puts(c->wrbuf, "</target>");
     }
     response_close(c, "bytarget");
diff --git a/test/test_solr_spell.cfg b/test/test_solr_spell.cfg
new file mode 100644 (file)
index 0000000..1c30567
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+  <!-- Used by test_solr.sh -->
+  <server>
+    <listen port="9763"/>
+    
+    <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="test-usersetting" brief="yes" setting="postproc"/>
+      <metadata name="test" setting="parameter"/>
+      <metadata name="test-usersetting-2" brief="yes"/>
+    </service>
+
+  </server>
+
+</pazpar2>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
diff --git a/test/test_solr_spell.sh b/test/test_solr_spell.sh
new file mode 100755 (executable)
index 0000000..6f2961f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# srcdir might be set by make
+srcdir=${srcdir:-"."}
+
+#TODO set up solr target. For now use donut 
+#F=../solr/client.sh 
+#
+#rm -f solr.pid
+#$F -l solr.log -p ztest.pid -D @:9999
+#sleep 1
+#if test ! -f ztest.pid; then
+#    echo "yaz-ztest could not be started"
+#    exit 0
+#fi
+
+${srcdir}/run_pazpar2.sh test_solr_spell
+E=$?
+
+#kill `cat ztest.pid`
+#rm ztest.pid
+exit $E
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End:
diff --git a/test/test_solr_spell.urls b/test/test_solr_spell.urls
new file mode 100644 (file)
index 0000000..0a42801
--- /dev/null
@@ -0,0 +1,6 @@
+http://localhost:9763/search.pz2?command=init&clear=1
+http://localhost:9763/search.pz2?session=1&command=settings&pz%3Atermlist_term_count%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=10&use_url_proxy%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=0&pz%3Apiggyback%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1&pz%3Apreferred%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1&pz%3Acclmap%3Asu%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Dsubject&pz%3Asru%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=solr&use_thumbnails%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=0&pz%3Acclmap%3Adate%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Ddate&medium%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=web&pz%3Aname%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=ocs_test&pz%3Acclmap%3Aissn%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=u%3D8&pz%3Acclmap%3Ati%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Dtitle&pz%3Acclmap%3Aau%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Dauthor&pz%3Axslt%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=solr-pz2.xsl&pz%3Acclmap%3Aterm%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Dtext+s%3Dal&pz%3Acclmap%3Aisbn%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=1%3Disbn&pz%3Aqueryencoding%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=UTF-8&pz%3Aextra_args%5Bocs-test.indexdata.com%2Fsolr%2Fselect%5D=spellcheck=true
+http://localhost:9763/search.pz2?session=1&command=search&query=kingg
+2 http://localhost:9763/search.pz2?session=1&command=show&block=preferred
+http://localhost:9763/search.pz2?session=1&command=termlist&name=xtargets%2Csubject%2Cauthor%2Cdate%2Cmedium
+http://localhost:9763/search.pz2?session=1&command=bytarget
diff --git a/test/test_solr_spell_1.res b/test/test_solr_spell_1.res
new file mode 100644 (file)
index 0000000..81ff9ff
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>1</session><protocol>1</protocol></init>
\ No newline at end of file
diff --git a/test/test_solr_spell_2.res b/test/test_solr_spell_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_solr_spell_3.res b/test/test_solr_spell_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_solr_spell_4.res b/test/test_solr_spell_4.res
new file mode 100644 (file)
index 0000000..5a1147b
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>0</merged>
+<total>0</total>
+<start>0</start>
+<num>0</num>
+</show>
\ No newline at end of file
diff --git a/test/test_solr_spell_5.res b/test/test_solr_spell_5.res
new file mode 100644 (file)
index 0000000..848b25c
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<termlist><activeclients>0</activeclients>
+<list name="xtargets">
+</list>
+<list name="subject">
+</list>
+<list name="author">
+</list>
+<list name="date">
+</list>
+<list name="medium">
+</list>
+</termlist>
\ No newline at end of file
diff --git a/test/test_solr_spell_6.res b/test/test_solr_spell_6.res
new file mode 100644 (file)
index 0000000..abf47c8
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bytarget><status>OK</status>
+<target><id>ocs-test.indexdata.com/solr/select</id>
+<name>ocs_test</name>
+<hits>0</hits>
+<diagnostic>0</diagnostic>
+<records>0</records>
+<state>Client_Idle</state>
+<misspelled term="kingg">
+<suggestion>king</suggestion>
+<suggestion>kinga</suggestion>
+<suggestion>kingp</suggestion>
+<suggestion>lingg</suggestion>
+<suggestion>kingv</suggestion>
+</misspelled>
+</target></bytarget>
\ No newline at end of file