Starting with Zebra
version 2.0.5 or newer, it is
possible to use a special element set which has the prefix
zebra::
.
Using this element will, regardless of record type, return Zebra's internal index structure/data for a record. In particular, the regular record filters are not invoked when these are in use. This can in some cases make the retrieval faster than regular retrieval operations (for MARC, XML etc).
Table 4.1. Special Retrieval Elements
Element Set | Description | Syntax |
---|---|---|
zebra::meta::sysno | Get Zebra record system ID | XML and SUTRS |
zebra::data | Get raw record | all |
zebra::meta | Get Zebra record internal metadata | XML and SUTRS |
zebra::index | Get all indexed keys for record | XML and SUTRS |
zebra::index:: f
|
Get indexed keys for field f for record
| XML and SUTRS |
zebra::index:: f :t
|
Get indexed keys for field f
and type t for record
| XML and SUTRS |
zebra::snippet
|
Get snippet for record for one or more indexes (f1,f2,..).
This includes a phrase from the original
record at the point where a match occurs (for a query). By default
give terms before - and after are included in the snippet. The
matching terms are enclosed within element
<s> . The snippet facility requires
Zebra 2.0.16 or later.
| XML and SUTRS |
zebra::facet:: f1 :t1 ,f2 :t2 ,..
| Get facet of a result set. The facet result is returned as if it was a normal record, while in reality is a recap of most "important" terms in a result set for the fields given. The facet facility first appeared in Zebra 2.0.20. | XML |
For example, to fetch the raw binary record data stored in the zebra internal storage, or on the filesystem, the following commands can be issued:
Z> f @attr 1=title my Z> format xml Z> elements zebra::data Z> s 1+1 Z> format sutrs Z> s 1+1 Z> format usmarc Z> s 1+1
The special
zebra::data
element set name is
defined for any record syntax, but will always fetch
the raw record data in exactly the original form. No record syntax
specific transformations will be applied to the raw record data.
Also, Zebra internal metadata about the record can be accessed:
Z> f @attr 1=title my Z> format xml Z> elements zebra::meta::sysno Z> s 1+1
displays in XML
record syntax only internal
record system number, whereas
Z> f @attr 1=title my Z> format xml Z> elements zebra::meta Z> s 1+1
displays all available metadata on the record. These include system number, database name, indexed filename, filter used for indexing, score and static ranking information and finally bytesize of record.
Sometimes, it is very hard to figure out what exactly has been indexed how and in which indexes. Using the indexing stylesheet of the Alvis filter, one can at least see which portion of the record went into which index, but a similar aid does not exist for all other indexing filters.
The special
zebra::index
element set names are provided to
access information on per record indexed fields. For example, the
queries
Z> f @attr 1=title my Z> format sutrs Z> elements zebra::index Z> s 1+1
will display all indexed tokens from all indexed fields of the
first record, and it will display in SUTRS
record syntax, whereas
Z> f @attr 1=title my Z> format xml Z> elements zebra::index::title Z> s 1+1 Z> elements zebra::index::title:p Z> s 1+1
displays in XML
record syntax only the content
of the zebra string index title
, or
even only the type p
phrase indexed part of it.
Trying to access numeric BIB-1
use
attributes or trying to access non-existent zebra intern string
access points will result in a Diagnostic 25: Specified element set
'name not valid for specified database.