|
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
">Example 1: XML Indexing And SearchingThis example shows how Zebra can be used with absolutely minimal configuration to index a body of XML documents, and search them using XPath expressions to specify access points. Go to the examples/zthes subdirectory of the distribution archive. There you will find a Makefile that will populate the records subdirectory with a file of Zthes records representing a taxonomic hierarchy of dinosaurs. (The records are generated from the family tree in the file dino.tree.) Type to make the XML data file. Now we need to create a Zebra database to hold and index the XML records. We do this with the Zebra indexer, zebraidx, which is driven by the zebra.cfg configuration file. For our purposes, we don't need any special behaviour - we can use the defaults - so we start with a minimal file that just tells zebraidx where to find the default indexing rules, and how to parse the records:
That's all you need for a minimal Zebra configuration. Now you can roll the XML records into the database and build the indexes:
Now start the server. Like the indexer, its behaviour is controlled by the zebra.cfg file; and like the indexer, it works just fine with this minimal configuration.
Now you can use the Z39.50 client program of your choice to execute XPath-based boolean queries and fetch the XML records that satisfy them:
Now wasn't that easy? |