def GET(self, path): # get variables including the user preferences i = web.input(s=0, so='', ot='') start = int(i.s) pref = user_pref.get() # transform pretty url path into a query query = fsphinx.PrettyUrlToQuery(path, order=i.ot) # call model to search the items query, hits, facets = items.search(query, start, config.results_per_page, i.so, pref) # handle empty result set if not hits.total_found: facets = items.get_facets_from_cache('', pref) # create a pager to go through the results pager = paging.get_paging(start, hits['total_found'], results_per_page=config.results_per_page, window_size=config.paging_window_size) # call the proper view to display the results return view.layout(view.search(query, hits, facets, pager, pref))
def GET(self, path): # get variables including the user preferences i = web.input(s=0, so='', debug=False, ot='') start = int(i.s) pref = user_pref.get() # transform pretty url path into a query query = fsphinx.PrettyUrlToQuery(path, order=i.ot) # call model to search the items query, hits, facets = items.search(query, start, config.results_per_page, i.so, pref) # handle empty result set if not hits.total_found: facets = items.get_facets_from_cache('', pref) # create a pager to go through the results pager = paging.get_paging(start, hits['total_found'], results_per_page=config.results_per_page, window_size=config.paging_window_size) # call the proper view to display the results return view.layout(view.search(query, hits, facets, pager, pref))
def GET(self): pref = user_pref.reset() facets = items.get_facets_from_cache('', pref) return view.layout(view.front_page(facets, pref))