Update zthes example 2 to use xelm
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 30 Dec 2002 12:56:07 +0000 (12:56 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 30 Dec 2002 12:56:07 +0000 (12:56 +0000)
doc/administration.xml
doc/examples.xml
examples/zthes/Makefile.am
examples/zthes/Zthes.abs
examples/zthes/zebra.cfg
index/extract.c

index ff6410e..299b1d0 100644 (file)
@@ -1,5 +1,5 @@
 <chapter id="administration">
- <!-- $Id: administration.xml,v 1.15 2002-12-03 16:40:17 adam Exp $ -->
+ <!-- $Id: administration.xml,v 1.16 2002-12-30 12:56:07 adam Exp $ -->
  <title>Administrating Zebra</title>
  <!-- ### It's a bit daft that this chapter (which describes half of
           the configuration-file formats) is separated from
   <para>
    
    <screen>
-    profilePath: /usr/local/yaz
+    profilePath: /usr/local/idzebra/tab
     attset: bib1.att
     simple.recordType: text
     simple.database: textbase
index dc95e12..f8f9a20 100644 (file)
@@ -1,5 +1,5 @@
 <chapter id="examples">
- <!-- $Id: examples.xml,v 1.18 2002-12-01 23:26:26 mike Exp $ -->
+ <!-- $Id: examples.xml,v 1.19 2002-12-30 12:56:07 adam Exp $ -->
  <title>Example Configurations</title>
 
  <sect1>
@@ -81,7 +81,7 @@
    <literal>dino.tree</literal>.)
    Type <literal>make records/dino.xml</literal>
    to make the XML data file.
-   (Or you could just type <literal>make</literal> to build the XML
+   (Or you could just type <literal>make dino</literal> to build the XML
    data file, create the database and populate it with the taxonomic
    records all in one shot - but then you wouldn't learn anything,
    would you?  :-)
    <literal>&lt;Zthes&gt;</literal> element.
   </para>
   <para>
-   ### Here's where it all goes to pieces.  The current arrangement is
-   very awkward (and somewhat embarrassing) to describe, and the new
-   arrangement hasn't actually been implemented yet.
-  </para>
-  <para>
    This is a two-step process.  First, we need to tell Zebra that we
    want to support the BIB-1 attribute set.  Then we need to tell it
    which elements of its record pertain to access point 4.
-  </para>
-  <para>
+   </para>
+   <para>
    We need to create an <link linkend="abs-file">Abstract Syntax
    file</link> named after the document element of the records we're
-   working with, plus a <literal>.abs</literal> suffix - in this case,
-   <literal>Zthes.abs</literal> - as follows:
-  </para>
-  <itemizedlist>
-   <listitem>
-    <para>
-     
-    </para>
-   </listitem>
-   <listitem>
-    <para>
-    </para>
-   </listitem>
-  </itemizedlist>
+    working with, plus a <literal>.abs</literal> suffix - in this case,
+    <literal>Zthes.abs</literal> - as follows:
+   </para>
+   <programlistingco>
+    <areaspec>
+     <area id="attset.zthes" coords="2"/>
+     <area id="attset.attset" coords="3"/>
+     <area id="termId" coords="7"/>
+     <area id="termName" coords="8"/>
+    </areaspec>
+    <programlisting>
+attset zthes.att
+attset bib1.att
+xpath enable
+systag sysno none
+
+xelm /Zthes/termId              termId:w
+xelm /Zthes/termName            termName:w,title:w
+xelm /Zthes/termQualifier       termQualifier:w
+xelm /Zthes/termType            termType:w
+xelm /Zthes/termLanguage        termLanguage:w
+xelm /Zthes/termNote            termNote:w
+xelm /Zthes/termCreatedDate     termCreatedDate:w
+xelm /Zthes/termCreatedBy       termCreatedBy:w
+xelm /Zthes/termModifiedDate    termModifiedDate:w
+xelm /Zthes/termModifiedBy      termModifiedBy:w
+    </programlisting>
+   <calloutlist>
+    <callout arearefs="attset.zthes">
+     <para>
+      Declare Thesausus attribute set. See <filename>zthes.att</filename>.
+     </para>
+    </callout>
+    <callout arearefs="attset.attset">
+     <para>
+      Declare Bib-1 attribute set. See <filename>bib1.att</filename> in
+      Zebra's <filename>tab</filename> directory.
+     </para>
+    </callout>
+    <callout arearefs="termId">
+     <para>
+      This xelm directive selects contents of nodes by XPath expression
+      <literal>/Zthes/termId</literal>. The contents (CDATA) will be
+      word searchable by Zthes attribute termId (value 1001).
+     </para>
+    </callout>
+    <callout arearefs="termName">
+     <para>
+      Make <literal>termName</literal> word searchable by both
+      Zthes attribute termName (1002) and Bib-1 atttribute title (4).
+     </para>
+    </callout>
+   </calloutlist>
+  </programlistingco>
+   <para>
+    After re-indexing, we can search the database using Bib-1
+    attribute, title, as follows:
+    <screen>
+Z> form xml
+Z> f @attr 1=4 Eoraptor
+Sent searchRequest.
+Received SearchResponse.
+Search was a success.
+Number of hits: 1, setno 1
+SearchResult-1: Eoraptor(1)
+records returned: 0
+Elapsed: 0.106896
+Z> s
+Sent presentRequest (1+1).
+Records: 1
+[Default]Record type: XML
+&lt;Zthes&gt;
+ &lt;termId&gt;2&lt;/termId&gt;
+ &lt;termName&gt;Eoraptor&lt;/termName&gt;
+ &lt;termType&gt;PT&lt;/termType&gt;
+ &lt;termNote&gt;The most basal known dinosaur&lt;/termNote&gt;
+ ...
+    </screen>
+   </para>
  </sect1>
 </chapter>
 
index 1063baa..2e1fd20 100644 (file)
@@ -1,12 +1,11 @@
-EXTRA_DIST = zebra.cfg Zthes.abs zthes.att zthes.tag \
-  tagsetg-zthes.tag tagsetm-zthes.tag tree2xml.pl dino.tree
+EXTRA_DIST = zebra.cfg Zthes.abs zthes.att tree2xml.pl dino.tree
 
-dist-hook:
-       -mkdir $(distdir)/records
+# optional: tagsetg-zthes.tag tagsetm-zthes.tag zthes.tag 
+dino: reci-0.mf
 
-recdA-0.mf: records/dino.xml
-       zebraidx init
-       zebraidx update records
+reci-0.mf: records/dino.xml
+       ../../index/zebraidx init
+       ../../index/zebraidx update records
 
 records/dino.xml: tree2xml.pl dino.tree
        ./tree2xml.pl dino.tree > records/dino.xml
@@ -14,3 +13,5 @@ records/dino.xml: tree2xml.pl dino.tree
 clean:
        rm -f records/dino.xml *.mf *.LCK zebrasrv.pid
 
+dist-hook:
+       -mkdir $(distdir)/records
index 4d610ba..bf598d0 100644 (file)
@@ -1,31 +1,15 @@
 attset zthes.att
-tagset tagsetm-zthes.tag
-tagset tagsetg-zthes.tag
-tagset zthes.tag
+attset bib1.att
 xpath enable
 systag sysno none
 
-elm (1,14)     termId                  !
-elm (2,1)      termName                !
-elm (4,1)      termQualifier           !
-elm (4,2)      termType                !
-elm (2,20)     termLanguage            !
-elm (2,17)     termNote                !
-elm (1,15)     termCreatedDate         !
-elm (1,27)     termCreatedBy           !
-elm (1,16)     termModifiedDate        !
-elm (1,28)     termModifiedBy          !
-
-elm (4,4)      postings                -
-elm (4,4)/(2,36)       sourceDb        -
-elm (4,4)/(4,5)                fieldName       -
-elm (4,4)/(4,6)                hitCount        -
-
-elm (2,30)     relation                -
-elm (2,30)/(4,3)       relationType    -
-elm (2,30)/(2,36)      sourceDb        -
-elm (2,30)/(1,14)      termId          -
-elm (2,30)/(2,1)       termName        -
-elm (2,30)/(4,1)       termQualifier   -
-elm (2,30)/(4,2)       termType        -
-elm (2,30)/(2,20)      termLanguage    -
+xelm /Zthes/termId             termId:w
+xelm /Zthes/termName           termName:w,title:w
+xelm /Zthes/termQualifier      termQualifier:w
+xelm /Zthes/termType           termType:w
+xelm /Zthes/termLanguage       termLanguage:w
+xelm /Zthes/termNote           termNote:w
+xelm /Zthes/termCreatedDate    termCreatedDate:w
+xelm /Zthes/termCreatedBy      termCreatedBy:w
+xelm /Zthes/termModifiedDate   termModifiedDate:w
+xelm /Zthes/termModifiedBy     termModifiedBy:w
index 48742e8..05fbc08 100644 (file)
@@ -1,4 +1,5 @@
-# $Id: zebra.cfg,v 1.4 2002-12-02 16:55:14 adam Exp $
+# $Id: zebra.cfg,v 1.5 2002-12-30 12:56:07 adam Exp $
 profilePath: .:../../tab
 recordType: grs.sgml
 attset: zthes.att
+attset: bib1.att
index ee771ac..6ee0d0e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: extract.c,v 1.133 2002-12-16 22:59:34 adam Exp $
+/* $Id: extract.c,v 1.134 2002-12-30 12:56:07 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -1727,10 +1727,11 @@ void extract_token_add (RecWord *p)
 {
     WRBUF wrbuf;
 
+#if 0
     yaz_log (LOG_LOG, "reg_type=%c attrSet=%d attrUse=%d seqno=%d s=%.*s",
              p->reg_type, p->attrSet, p->attrUse, p->seqno, p->length,
              p->string);
-
+#endif
     if ((wrbuf = zebra_replace(p->zebra_maps, p->reg_type, 0,
                               p->string, p->length)))
     {