當前位置: 首頁>>代碼示例>>Python>>正文


Python Point.search方法代碼示例

本文整理匯總了Python中models.point.Point.search方法的典型用法代碼示例。如果您正苦於以下問題:Python Point.search方法的具體用法?Python Point.search怎麽用?Python Point.search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.point.Point的用法示例。


在下文中一共展示了Point.search方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: post

# 需要導入模塊: from models.point import Point [as 別名]
# 或者: from models.point.Point import search [as 別名]
 def post(self):
     resultJSON = json.dumps({'result': False})
     searchResultsFuture = Point.search(
         searchTerms=self.request.get('searchTerms'), 
         user=self.current_user,
         excludeURL=self.request.get('exclude'), 
         linkType=self.request.get('linkType') 
     )
     searchResults = None
     if searchResultsFuture:
         searchResults = searchResultsFuture.get_result()
         
     template_values = {
         'points': searchResults,
         'linkType': self.request.get('linkType'),
     }
     resultsHTML = self.template_render('pointBoxList.html', template_values)
     
     if searchResults:
         resultJSON = json.dumps({
             'result': True,
             'resultsHTML': resultsHTML,
             'searchString': self.request.get('searchTerms')
         })
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
     self.response.out.write(resultJSON)
開發者ID:aaronlifshin,項目名稱:whysaurus,代碼行數:28,代碼來源:ajaxsearch.py

示例2: post

# 需要導入模塊: from models.point import Point [as 別名]
# 或者: from models.point.Point import search [as 別名]
 def post(self):
     searchString = self.request.get('searchTerms')
     searchResults = Point.search(searchString, nodeType=None)
     result = len(searchResults) if searchResults else 0
     template_values = {
         'searchResults': searchResults,
         'searchString': searchString,
     }
     path = os.path.join(constants.ROOT, 'templates/searchResults.html')
     self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
     html = template.render(path, template_values)
     json_values = {'html':html,
                    'searchString': searchString,
                    'result':result
                    }
     self.response.out.write(json.dumps(json_values))
開發者ID:aaronlifshin,項目名稱:howtosavedemocaracy,代碼行數:18,代碼來源:search.py

示例3: post

# 需要導入模塊: from models.point import Point [as 別名]
# 或者: from models.point.Point import search [as 別名]
 def post(self):
     resultJSON = json.dumps({'result': False})
     searchResults = Point.search(searchTerms=self.request.get('searchTerms'), 
                                  excludeURL=self.request.get('exclude'), 
                                  linkType=self.request.get('linkType'),
                                  nodeType=self.request.get('nodetype'))
     template_values = {
         'points': searchResults,
         'linkType': self.request.get('linkType'),
         'thresholds': constants.SCORETHRESHOLDS
     }
     path = os.path.join(constants.ROOT, 'templates/pointBoxList.html')
     resultsHTML = template.render(path, template_values)
     
     if searchResults:
         resultJSON = json.dumps({
             'result': True,
             'resultsHTML': resultsHTML,
             'searchString': self.request.get('searchTerms')
         })
     self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
     self.response.out.write(resultJSON)
開發者ID:aaronlifshin,項目名稱:howtosavedemocaracy,代碼行數:24,代碼來源:ajaxsearch.py

示例4: post

# 需要導入模塊: from models.point import Point [as 別名]
# 或者: from models.point.Point import search [as 別名]
 def post(self):
     searchString = self.request.get('searchTerms')
     searchResultsFuture = Point.search(
         user=self.current_user, 
         searchTerms=searchString
     )
     searchResults = None
     if searchResultsFuture:
         searchResults = searchResultsFuture.get_result()
                     
     result = len(searchResults) if searchResults else 0
     template_values = {
         'searchResults': searchResults,
         'searchString': searchString,
     }
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'        
     html = self.template_render('searchResults.html', template_values)
     json_values = {'html':html,
                    'searchString': searchString,
                    'result':result
                    }
     self.response.out.write(json.dumps(json_values))
開發者ID:aaronlifshin,項目名稱:whysaurus,代碼行數:24,代碼來源:search.py


注:本文中的models.point.Point.search方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。