|
|
Index Data > Zebra > Zebra - User's Guide and Reference > Extended Services: Remote Insert, Update and Delete NoteExtended services are only supported when accessing the Zebra server using the Z39.50 protocol. The SRU protocol does not support extended services.
The extended services are not enabled by default in zebra - due to the
fact that they modify the system. Zebra can be configured
to allow anybody to
search, and to allow only updates for a particular admin user
in the main zebra configuration file
perm.anonymous: r
perm.admin: rw
passwd: passwordfile
And in the password file
admin:secret
It is essential to configure Zebra to store records internally, and to support modifications and deletion of records:
storeData: 1
storeKeys: 1
The general record type should be set to any record filter which is able to parse XML records, you may use any of the two declarations (but not both simultaneously!)
recordType: dom.filter_dom_conf.xml
# recordType: grs.xml
Notice the difference to the specific instructions
recordType.xml: dom.filter_dom_conf.xml
# recordType.xml: grs.xml
which only work when indexing XML files from the filesystem using
the To enable transaction safe shadow indexing, which is extra important for this kind of operation, set
shadow: directoryname: size (e.g. 1000M)
See the section called “The Zebra Configuration File” for additional information on these configuration options. NoteIt is not possible to carry information about record types or similar to Zebra when using extended services, due to limitations of the Z39.50 protocol. Therefore, indexing filters can not be chosen on a per-record basis. One and only one general XML indexing filter must be defined. The Z39.50 standard allows servers to accept special binary extended services protocol packages, which may be used to insert, update and delete records into servers. These carry control and update information to the servers, which are encoded in seven package fields: Table 6.1. Extended services Z39.50 Package Fields
The
During all actions, the
usual rules for internal record ID generation apply, unless an
optional
Setting of the
When retrieving existing
records indexed with GRS-1 indexing filters, the Zebra internal
ID number is returned in the field
A new element set for retrieval of internal record
data has been added, which can be used to access minimal records
containing only the
The We can now start a yaz-client admin session and create a database:
$ yaz-client localhost:9999 -u admin/secret
Z> adm-create
Now the
Z> update insert id1234 esdd0006.grs
The 3rd parameter - Actually, we should have a way to specify "no opaque record id" for yaz-client's update command.. We'll fix that. The newly inserted record can be searched as usual:
Z> f utah
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 1, setno 1
SearchResult-1: term=utah cnt=1
records returned: 0
Elapsed: 0.014179
Let's delete the beast, using the same
Z> update delete id1234
No last record (update ignored)
Z> update delete 1 esdd0006.grs
Got extended services response
Status: done
Elapsed: 0.072441
Z> f utah
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 0, setno 2
SearchResult-1: term=utah cnt=0
records returned: 0
Elapsed: 0.013610
If shadow register is enabled in your
Z> adm-commit
after each update session in order write your changes from the shadow to the life register space. Extended services are also available from the YAZ PHP client layer. An example of an YAZ-PHP extended service transaction is given here:
$record = '<record><title>A fine specimen of a record</title></record>';
$options = array('action' => 'recordInsert',
'syntax' => 'xml',
'record' => $record,
'databaseName' => 'mydatabase'
);
yaz_es($yaz, 'update', $options);
yaz_es($yaz, 'commit', array());
yaz_wait();
if ($error = yaz_error($yaz))
echo "$error";
When debugging ES over PHP we recomment the following order of tests:
|
|||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Copyright Index Data ApS 2008 | ||||||||||||||||||||||||||||