def GET(self): global ftoken_db i = web.input(author_key=[], language=[], first_publish_year=[], publisher_facet=[], subject_facet=[], person_facet=[], place_facet=[], time_facet=[], public_scan_b=[]) if i.get('ftokens') and ',' not in i.ftokens: token = i.ftokens #if ftoken_db is None: # ftoken_db = dbm.open('/olsystem/ftokens', 'r') #if ftoken_db.get(token): # raise web.seeother('/subjects/' + ftoken_db[token].decode('utf-8').lower().replace(' ', '_')) if i.get('wisbn'): i.isbn = i.wisbn self.redirect_if_needed(i) if 'isbn' in i and all(not v for k, v in i.items() if k != 'isbn'): self.isbn_redirect(i.isbn) q_list = [] q = i.get('q', '').strip() if q: m = re_olid.match(q) if m: raise web.seeother('/%s/%s' % (olid_urls[m.group(1)], q)) m = re_isbn_field.match(q) if m: self.isbn_redirect(m.group(1)) q_list.append(q) for k in ('title', 'author', 'isbn', 'subject', 'place', 'person', 'publisher'): if k in i: v = re_to_esc.sub(lambda m:'\\' + m.group(), i[k].strip()) q_list.append(k + ':' + v) return render.work_search(i, ' '.join(q_list), do_search, get_doc)
def GET(self): # Enable patrons to search for query q2 within collection q # q2 param gets removed and prepended to q via a redirect _i = web.input(q='', q2='') if _i.q.strip() and _i.q2.strip(): _i.q = _i.q2.strip() + ' ' + _i.q.strip() _i.pop('q2') raise web.seeother('/search?' + urllib.parse.urlencode(_i)) i = web.input( author_key=[], language=[], first_publish_year=[], publisher_facet=[], subject_facet=[], person_facet=[], place_facet=[], time_facet=[], public_scan_b=[], ) # Send to full-text Search Inside if checkbox checked if i.get('search-fulltext'): raise web.seeother('/search/inside?' + urllib.parse.urlencode({'q': i.get('q', '')})) if i.get('wisbn'): i.isbn = i.wisbn self.redirect_if_needed(i) if 'isbn' in i: self.isbn_redirect(i.isbn) q_list = [] q = i.get('q', '').strip() if q: m = re_olid.match(q) if m: raise web.seeother(f'/{OLID_URLS[m.group(1)]}/{q}') m = re_isbn_field.match(q) if m: self.isbn_redirect(m.group(1)) q_list.append(q) for k in ('title', 'author', 'isbn', 'subject', 'place', 'person', 'publisher'): if k in i: v = re_to_esc.sub(r'\\\g<0>', i[k].strip()) q_list.append(k + ':' + v) return render.work_search( i, ' '.join(q_list), do_search, get_doc, get_availability_of_ocaids, fulltext_search, FACET_FIELDS, )
def GET(self): global ftoken_db i = web.input(author_key=[], language=[], first_publish_year=[], publisher_facet=[], subject_facet=[], person_facet=[], place_facet=[], time_facet=[], public_scan_b=[]) # Send to full-text Search Inside if checkbox checked if i.get('search-fulltext'): raise web.seeother('/search/inside?' + urllib.urlencode({'q': i.get('q', '')})) if i.get('ftokens') and ',' not in i.ftokens: token = i.ftokens #if ftoken_db is None: # ftoken_db = dbm.open('/olsystem/ftokens', 'r') #if ftoken_db.get(token): # raise web.seeother('/subjects/' + ftoken_db[token].decode('utf-8').lower().replace(' ', '_')) if i.get('wisbn'): i.isbn = i.wisbn self.redirect_if_needed(i) if 'isbn' in i: self.isbn_redirect(i.isbn) q_list = [] q = i.get('q', '').strip() if q: m = re_olid.match(q) if m: raise web.seeother('/%s/%s' % (olid_urls[m.group(1)], q)) m = re_isbn_field.match(q) if m: self.isbn_redirect(m.group(1)) q_list.append(q) for k in ('title', 'author', 'isbn', 'subject', 'place', 'person', 'publisher'): if k in i: v = re_to_esc.sub(lambda m: '\\' + m.group(), i[k].strip()) q_list.append(k + ':' + v) page = render.work_search(i, ' '.join(q_list), do_search, get_doc, get_availability_of_ocaids, fulltext_search) page.v2 = True return page
def GET(self): global ftoken_db i = web.input(author_key=[], language=[], first_publish_year=[], publisher_facet=[], subject_facet=[], person_facet=[], place_facet=[], time_facet=[], public_scan_b=[]) # Send to full-text Search Inside if checkbox checked if i.get('search-fulltext'): raise web.seeother('/search/inside?' + urllib.urlencode({'q': i.get('q', '')})) if i.get('ftokens') and ',' not in i.ftokens: token = i.ftokens #if ftoken_db is None: # ftoken_db = dbm.open('/olsystem/ftokens', 'r') #if ftoken_db.get(token): # raise web.seeother('/subjects/' + ftoken_db[token].decode('utf-8').lower().replace(' ', '_')) if i.get('wisbn'): i.isbn = i.wisbn self.redirect_if_needed(i) if 'isbn' in i: self.isbn_redirect(i.isbn) q_list = [] q = i.get('q', '').strip() if q: m = re_olid.match(q) if m: raise web.seeother('/%s/%s' % (olid_urls[m.group(1)], q)) m = re_isbn_field.match(q) if m: self.isbn_redirect(m.group(1)) q_list.append(q) for k in ('title', 'author', 'isbn', 'subject', 'place', 'person', 'publisher'): if k in i: v = re_to_esc.sub(lambda m:'\\' + m.group(), i[k].strip()) q_list.append(k + ':' + v) page = render.work_search( i, ' '.join(q_list), do_search, get_doc, get_availability_of_ocaids, fulltext_search) page.v2 = True return page