Query MetaLib X-server from ALEPH OPAC
Tags: php
, metalib
, opac
, x-server
, prototype
, ajax
, federated
, search
, javascript
Last Updated: Oct 30, 2009 00:49
- Author: Daniel Forsman
- Institution:
Högskolan i Jönköping - Year: 2008
- License: BSD style
- Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
- Link to terms: [Detailed license terms]
- Skill required for using this code:
intermediate/advanced
Description
When a search is done in the local OPAC the query is passed to MetaLib X-server and search results are displayed in the OPAC. This is a way to give the users a small federated search from within the OPAC. Putting the local search in a broader context.
State
Stable
Screen captures

Above: Search is being processed by MetaLib
Below: Search has completed and results are displayed. If the user wants to look at the results they click the hyperlink and are taken to the MetaLib Interface.

Author(s) homepage
Download
See attachments.
Working example
http://julia.hj.se/F/?func=find-b&request=php&find_code=WRD&adjacent=N&x=0&y=0&CON_LNG=ENG
Using the following Ex Libris API
MetaLib X-Server : Find_request
Known issues
MetaLib response time
Installation instructions
Requirements: You will need PHP5 installed on your Aleph OPAC webserver.
1. Download the javascript framework Prototype
2. Make Prototype available in your OPAC. We include it in meta-tags.
3. Create a id where you want to include the results of the search. We use a "invisible" span that is included on all pages on the head-1-XXX pages like this in head-1-bor-XXX01.
On a side-note if you have a html template for navigation etc a good tip is not to repeat that on every page but instead create a include-file for head-1-bor, head-1-nobor etc.
4. Include the metalib.js javascript that catches the searchterm and sends of the query via AJAX to the PHP backend script. The script parses the URL for the function=find-b variable. If it is there it tries to catch the search terms and pass them on. If there is no find-b the script does nothing. So you can include it in the same place as the span id in step 3. This is where we include it (head-1-XXX). If you are doing several AJAX calls you can include them in the same .js file. See the Using external API:s from your Aleph OPAC page for more on this.
5. While the query is being processed by MetaLib a AJAX activity indicator is shown. You will wan't to edit the metalib.js file and the "var img" variable so that it makes sense to the query that you are doing. Also this is where you can change the image of the indicator. I have attached the one we are using.
6. When you are editing the metalib.js file you also want to change the path to the metalib.php file to where you put it.
5. Upload the metalib.php file to your websever. Due to AJAX security issues you need to place the PHP file on your OPAC webserver.
6. Edit the metalib.php file so that it performs the search you want it to perform. I would not recommend that search too many databases due to the response time from MetaLib. I would also recommend that you use databases that has a fast response time. We use Google Scholar, Ebsco Academic Search and Science Direct. Three broad and full text oriented databases.
You will have to match the LIBXXXX to your corresponding ones from the MetaLib knowledge base. The syntax for searching databases are:
&find_base_001=LIBXXX&find_base_001=LIBXXX etc. and you edit this in the xmlDoc->load statement.
You will have to edit the URL for your MetaLib X-server (3 places) and include your own user_name and user_password. I have kept our links and base-url:s in the script for live examples, but i left out the password for our user ...
Comments
Text...

