Test of SOLR target
authorDennis Schafroth <dennis@indexdata.com>
Tue, 17 Aug 2010 12:29:58 +0000 (14:29 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Tue, 17 Aug 2010 12:29:58 +0000 (14:29 +0200)
test/solr-pz2.xsl [new file with mode: 0644]
test/test_solr.cfg [new file with mode: 0644]
test/test_solr.sh [new file with mode: 0755]
test/test_solr_urls [new file with mode: 0644]

diff --git a/test/solr-pz2.xsl b/test/solr-pz2.xsl
new file mode 100644 (file)
index 0000000..4267f99
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+               xmlns:pz="http://www.indexdata.com/pazpar2/1.0" >
+  <xsl:template  match="/">
+      <xsl:apply-templates></xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="doc">
+    <pz:record>
+      <xsl:apply-templates></xsl:apply-templates>
+    </pz:record>
+  </xsl:template>
+  <xsl:template match="str[@name]">
+    <pz:metadata>
+       <xsl:attribute  name="type">
+         <xsl:value-of select="@name"/>
+       </xsl:attribute>
+       <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="arr">
+    <xsl:for-each select="str">
+      <xsl:call-template name="string"/>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="string">
+      <pz:metadata>
+       <xsl:attribute  name="type">
+         <xsl:value-of select="../@name"/>
+       </xsl:attribute>
+       <xsl:value-of select="."/>
+      </pz:metadata>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/test/test_solr.cfg b/test/test_solr.cfg
new file mode 100644 (file)
index 0000000..65287b7
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+  <!-- Used by test_http.sh -->
+  <server>
+    <listen port="9763"/>
+    <proxy host="localhost"/>
+    
+    <service>
+      <include src="z3950_indexdata_com_marc.xml"/>
+      <targetprofiles type="local" src="../zeerex/records/"/>
+      <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="test-usersetting" brief="yes" setting="postproc"/>
+      <metadata name="test" setting="parameter"/>
+      <metadata name="test-usersetting-2" brief="yes"/>
+    </service>
+
+    <include src="*_service.xml"/> 
+    <include src="no_such_service.xml"/>
+
+  </server>
+  
+  
+</pazpar2>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
diff --git a/test/test_solr.sh b/test/test_solr.sh
new file mode 100755 (executable)
index 0000000..4e96d20
--- /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
+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_urls b/test/test_solr_urls
new file mode 100644 (file)
index 0000000..f2fa4ad
--- /dev/null
@@ -0,0 +1,7 @@
+http://localhost:9763/search.pz2?command=init&clear=1
+http://localhost:9763/search.pz2?session=1&command=settings&pz:sru%5Bdonut:8983%2Fsolr%2Fselect%5D=solr&pz%3Aname%5Bdonut%3A8983%2Fsolr%2Fselect%5D=SOLR+Test&pz%3Acclmap%3Ati%5Bdonut%3A8983%2Fsolr%2Fselect%5D=1%3Dtitle&pz%3Acclmap%3Asu%5Bdonut%3A8983%2Fsolr%2Fselect%5D=1%3Dsubject&pz%3Acclmap%3Aau%5Bdonut%3A8983%2Fsolr%2Fselect%5D=1%3Dauthor&pz%3Acclmap%3Aisbn%5Bdonut%3A8983%2Fsolr%2Fselect%5D=1%3Disbn&pz%3Acclmap%3Aterm%5Bdonut%3A8983%2Fsolr%2Fselect%5D=1%3Dtitle&pz%3Axslt%5Bdonut%3A8983%2Fsolr%2Fselect%5D=solr-pz2.xsl&pz%3Aqueryencoding%5Bdonut%3A8983%2Fsolr%2Fselect%5D=UTF-8
+http://localhost:9763/search.pz2?session=1&command=search&query=su%3D%22computer%22
+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&name=xtargets%2Cauthor%2Csubject%2Cdate
+