本文整理匯總了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)
示例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))
示例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)
示例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))