[%- 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('itempage'); #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 * 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().ids; j = req.finish; -%] Pines Catalogue Search: [% string %] http://http://gapines.org/opensearch/?target=mr_result&mr_search_type=[% type %]&mr_search_query=[% string %]&itempage=[% 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.id; FOREACH mr_id IN mr_list; req = session.request('open-ils.search.biblio.metarecord.mods_slim.retrieve', mr_id.0); req.wait_complete(); mods = req.recv().content(); req.finish; -%] [% mods.title() %] http://gapines.org/opac/?target=record_result&page=0&mrid=[% mr_id.0 %]&hits_per_page=10 <b>Author:</b> [% mods.author() %]<br> <b>Subjects:</b> [%- FOREACH sub IN mods.subject(); IF loop.count() > 5; ', ...'; LAST; END; IF loop.index; ', '; END; sub.list.0; END; -%] <b>Available:</b> [% mr_id.2 %] [%- END; -%]