1 % Embedded metasearching with the MasterKey Widget Set
9 There are lots of practical problems in building resource discovery
10 solutions. One of the biggest, and most ubiquitous is incorporating
11 metasearching functionality into existing web-sites -- for example,
12 content-management systems, library catalogues or intranets. In
13 general, even when access to metasearching is provided by simple
14 web-services such as [Pazpar2](http://www.indexdata.com/pazpar2),
15 integration work is seen as a major part of most projects.
17 Index Data provides several different toolkits for communicating with
18 its metasearching middleware, trading off varying degrees of
19 flexibility against convenience:
21 * libpz2.js -- a low-level JavaScript library for interrogating the
22 Service Proxy and Pazpar2. It allows the HTML/JavaScript programmer
23 to implement simple JavaScript functions to display facets, records,
26 * masterkey-ui-core -- a higher-level, complex JavaScript library that
27 uses libpz2.js to provide the pieces needed for building a
28 full-featured JavaScript application.
30 * MasterKey Demo UI -- an example of a searching application built on
31 top of masterkey-ui-core. Available as a public demo at
32 http://mk2.indexdata.com/
34 * MKDru -- a toolkit for embedding MasterKey-like searching into
37 All of these approaches require programming to a greater or lesser
38 extent. Against this backdrop, we introduced MKWS (the MasterKey
39 Widget Set) -- a set of simple, very high-level HTML+CSS+JavaScript
40 components that can be incorporated into any web-site to provide
41 MasterKey searching facilities. By placing `<div>`s with well-known
42 identifiers in any HTML page, the various components of an application
43 can be embedded: search-boxes, results areas, target information, etc.
49 The following is a complete MKWS-based searching application:
53 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
54 <title>MKWS demo client</title>
55 <script type="text/javascript" src="http://mkws.indexdata.com/mkws-complete.js"></script>
56 <link rel="stylesheet" href="http://mkws.indexdata.com/mkwsStyle.css" />
59 <div id="mkwsSearch"></div>
60 <div id="mkwsResults"></div>
64 Go ahead, try it! You don't even need a web-server. Just copy and
65 paste this HTML into a file on your computer -- `/tmp/magic.html`,
66 say -- and point your web-browser at it:
67 `file:///tmp/magic.html`. Just like that, you have working
74 If you know any HTML, the structure of the file will be familar to
75 you: the `<html>` element at the top level contains a `<head>` and a
76 `<body>`. In addition to whatever else you might want to put on your
77 page, you can add MKWS elements.
79 These fall into two categories. First, the prerequisites in the HTML
80 header, which are loaded from the tool site mkws.indexdata.com:
83 contains all the JavaScript needed by the widget-set.
86 provides the default CSS styling
88 Second, the `<div>` elements with special IDs that begin `mkws` can be
89 provided. These are filled in by the MKWS code, and provide the
90 components of the searching UI. The very simple application above has
91 only two such components: a search box and a results area. But more
92 are supported. The main `<div>`s are:
94 * `mkwsSearch` -- provides the search box and button.
96 * `mkwsResults` -- provides the results area, including a list of
97 brief records (which open out into full versions when clicked),
98 paging for large results sets, facets for refining a search,
99 sorting facilities, etc.
101 * `mkwsLang` -- provides links to switch between one of several
102 different UI languages. By default, English, Danish and German are
105 * `mkwsSwitch` -- provides links to switch between a view of the
106 result records and of the targets that provide them. Only
107 meaningful when `mkwsTargets` is also provided.
109 * `mkwsTargets` -- the area where per-target information will appear
110 when selected by the link in the `mkwsSwitch` area. Of interest
111 mostly for fault diagnosis rather than for end-users.
113 * `mkwsStat` --provides a status line summarising the statistics of
116 To see all of these working together, just put them all into the HTML
119 <div id="mkwsSwitch"></div>
120 <div id="mkwsLang"></div>
121 <div id="mkwsSearch"></div>
122 <div id="mkwsResults"></div>
123 <div id="mkwsTargets"></div>
124 <div id="mkwsStat"></div>
134 Control over HTML and CSS
135 -------------------------
139 More sophisticated applications will not simply place the `<div>`s
140 together, but position them carefully within an existing page
141 framework -- such as a Drupal template, an OPAC or a SharePoint page.
143 Breaking up mkwsResults
148 Popup results with jQuery UI
149 ----------------------------
154 Authentication and target configuration
155 ---------------------------------------
163 ### Configuration object
167 ### jQuery plugin invocation
171 ### The structure of the HTML generated by the MKWS widgets
177 Copyright (C) 2013 by IndexData ApS, <http://www.indexdata.com>