From: Adam Dickmeiss Date: Mon, 30 Dec 2002 12:56:07 +0000 (+0000) Subject: Update zthes example 2 to use xelm X-Git-Tag: ZEBRA.1.3.4.Roel~8 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=e809d64f640790b2695a659bd2eb0ebd4e3cf963;p=idzebra-moved-to-github.git Update zthes example 2 to use xelm --- diff --git a/doc/administration.xml b/doc/administration.xml index ff6410e..299b1d0 100644 --- a/doc/administration.xml +++ b/doc/administration.xml @@ -1,5 +1,5 @@ - + Administrating Zebra + Example Configurations @@ -81,7 +81,7 @@ dino.tree.) Type make records/dino.xml to make the XML data file. - (Or you could just type make to build the XML + (Or you could just type make dino 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? :-) @@ -227,32 +227,92 @@ <Zthes> element. - ### 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. - - 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. - - + + We need to create an Abstract Syntax file named after the document element of the records we're - working with, plus a .abs suffix - in this case, - Zthes.abs - as follows: - - - - - - - - - - - - + working with, plus a .abs suffix - in this case, + Zthes.abs - as follows: + + + + + + + + + +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 + + + + + Declare Thesausus attribute set. See zthes.att. + + + + + Declare Bib-1 attribute set. See bib1.att in + Zebra's tab directory. + + + + + This xelm directive selects contents of nodes by XPath expression + /Zthes/termId. The contents (CDATA) will be + word searchable by Zthes attribute termId (value 1001). + + + + + Make termName word searchable by both + Zthes attribute termName (1002) and Bib-1 atttribute title (4). + + + + + + After re-indexing, we can search the database using Bib-1 + attribute, title, as follows: + +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 +<Zthes> + <termId>2</termId> + <termName>Eoraptor</termName> + <termType>PT</termType> + <termNote>The most basal known dinosaur</termNote> + ... + + diff --git a/examples/zthes/Makefile.am b/examples/zthes/Makefile.am index 1063baa..2e1fd20 100644 --- a/examples/zthes/Makefile.am +++ b/examples/zthes/Makefile.am @@ -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 diff --git a/examples/zthes/Zthes.abs b/examples/zthes/Zthes.abs index 4d610ba..bf598d0 100644 --- a/examples/zthes/Zthes.abs +++ b/examples/zthes/Zthes.abs @@ -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 diff --git a/examples/zthes/zebra.cfg b/examples/zthes/zebra.cfg index 48742e8..05fbc08 100644 --- a/examples/zthes/zebra.cfg +++ b/examples/zthes/zebra.cfg @@ -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 diff --git a/index/extract.c b/index/extract.c index ee771ac..6ee0d0e 100644 --- a/index/extract.c +++ b/index/extract.c @@ -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))) {