[%- USE CGI; USE ws = WebSession; j = ws.bootstrap_client("/pines/conf/bootstrap.conf"); rank_threshold = 5000; pagesize = 10; IF CGI.param('pagesize'); pagesize = CGI.param('pagesize'); END; itempage = CGI.param('page'); #type,string,location,depth count_meth = 'open-ils.search.biblio.class.count'; #type,string,location,depth,limit,offset search_meth = 'open-ils.search.biblio.class'; session = ws.init_app_session('open-ils.search'); type = CGI.param('mr_search_type'); string = CGI.param('mr_search_query'); location = CGI.param('mr_search_location'); depth = CGI.param('mr_search_depth'); limit = pagesize; offset = ((itempage - 1) * pagesize) - 1; IF offset < 0; offset = 0; END; req = session.request(count_meth, type, string, location, depth); j = req.wait_complete(); count = req.recv().content(); j = req.finish; IF count > rank_threshold; search_meth = 'open-ils.search.biblio.class.unordered'; END; req = session.request(search_meth, type, string, location, depth, limit, offset); j = req.wait_complete(); list = req.recv().content(); j = req.finish; -%] Pines Catalogue Search: [% string %] http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=[% type %]&mr_search_query=[% string %]&page=[% itempage %]&mr_search_depth=[% depth %]&mr_search_location=[% location %] Search results for "[% string %]" at gapines.org en-us &copy;2004-2005, Georga Public Library Service. [% count %] [% offset + 1 %] [% pagesize %] [%- mr_list = list.ids; FOREACH mr_id IN mr_list; req = session.request('open-ils.search.biblio.metarecord.mods_slim.retrieve', mr_id.0); j = req.wait_complete(); mods = req.recv().content(); j = req.finish; -%] [% mods.title() %] http://gapines.org/opac/?target=record_result&page=0&mrid=[% mr_id.0 %]&hits_per_page=10 <b>Author:</b> <a href="http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=author&mr_search_query=[% mods.author() %]&page=1&mr_search_depth=[% depth %]&mr_search_location=[% location %]">[% mods.author() %]</a><br> <b>Subjects:</b> [%- FOREACH sub IN mods.subject(); IF loop.count() > 5; ', ...'; LAST; END; IF loop.index; ', '; END; -%]<a href="http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=subject&mr_search_query=[% sub.list.0 %]&page=1&mr_search_depth=[% depth %]&mr_search_location=[% location %]">[% sub.list.0 %]</a>[%- END; -%]<br> <b>Available:</b> [% mr_id.2 %] [%- END; -%]