def get(self): searchResults = Point.search(self.request.get('searchTerms')) template_values = { 'user': self.current_user, 'searchResults' : searchResults, 'searchString': self.request.get('searchTerms'), 'thresholds' : constants.SCORETHRESHOLDS } path = os.path.join(os.path.dirname(__file__), 'templates/searchResults.html') self.response.out.write(template.render(path, template_values))
def post(self): resultJSON = json.dumps({'result':False}) searchResults = Point.search(self.request.get('searchTerms'), self.request.get('exclude')) if searchResults: resultJSON = json.dumps( { 'result': True, 'searchResults' : searchResults, 'searchString': self.request.get('searchTerms') }) self.response.headers.add_header('content-type', 'application/json', charset='utf-8') self.response.out.write(resultJSON)