From 2daf1fe0cc58d608b12bc7cec78ffe67c4e50d63 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 7 Jun 2005 18:40:49 +0000 Subject: [PATCH] initial opensearch implementation git-svn-id: svn://svn.open-ils.org/ILS/trunk@769 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/opensearch.ttk | 93 ++++++++++++++++++++++++++++++++++++++ Open-ILS/src/extras/opensearch.xml | 16 +++++++ 2 files changed, 109 insertions(+) create mode 100644 Open-ILS/src/extras/opensearch.ttk create mode 100644 Open-ILS/src/extras/opensearch.xml diff --git a/Open-ILS/src/extras/opensearch.ttk b/Open-ILS/src/extras/opensearch.ttk new file mode 100644 index 0000000000..db2c1f6e56 --- /dev/null +++ b/Open-ILS/src/extras/opensearch.ttk @@ -0,0 +1,93 @@ +[%- +USE CGI; +USE WebSession; +WebSession.bootstrap(); + +rank_threshold = 5000; + +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 = WebSession.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; + +pagesize = 10; +IF CGI.param('pagesize'); + pagesize = CGI.param('pagesize'); +END; + +req = session.request(count_meth, type, string, location, depth); +req.wait_complete(); + +count = req.recv(); +req.finish; + +IF count > rank_threshold; + search_meth = 'open-ils.search.biblio.class.unorded'; +END; + +req = session.request(search_meth, type, string, location, depth, limit, offset); +req.wait_complete(); + +list = req.recv(); +req.finish; + +-%] + + + + Pines Catalogue Search: [% string %] + http://http://gapines.org/opensearch.ttk/?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 %] +[%- + +FOREACH mr_id IN list; + req = session.request('open-ils.search.biblio.metarecord.mods_slim.retrieve', mr_id); + req.wait_complete(); + + mods = req.recv(); + req.finish; + +-%] + + [% mods.title() %] + http://gapines.org/opac/?target=record_result&page=0&mrid=[% mr_id %]&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; +-%] + + +[%- + +END; + + -%] + diff --git a/Open-ILS/src/extras/opensearch.xml b/Open-ILS/src/extras/opensearch.xml new file mode 100644 index 0000000000..89835e770c --- /dev/null +++ b/Open-ILS/src/extras/opensearch.xml @@ -0,0 +1,16 @@ + + + http://gapines.org/opensearch.ttk/?target=mr_result&mr_search_type=keyword&mr_search_query={searchTerms}&itempage={startPage}&mr_search_depth=0&mr_search_location=1 + http://a9.com/-/spec/opensearchrss/1.0/ + Pines + Pines Consortium Catalogue + Search for books in Pines. + book library research + http://gapines.org/images/small_logo.jpg + harry potter + GPLS + mrylander@gmail.com + Product and search data &copy; 2005, Georgia Public Library Service, All Rights Reserved + open + false + -- 2.11.0