コード例 #1
0
 def resolve_full_claim_search(self, info, **args):
     searchResultsFuture = PointModel.search(user=info.context.current_user,
                                             searchTerms="\"" +
                                             (args['q'] or "") + "\"")
     searchResults = searchResultsFuture.get_result(
     ) if searchResultsFuture else []
     return PagedPoints(points=searchResults, hasMore=False)
コード例 #2
0
    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)
コード例 #3
0
 def resolve_search(self, info, **args):
     searchResultsFuture = PointModel.search(user=info.context.current_user,
                                             searchTerms="\"" +
                                             (args['query'] or "") + "\"")
     searchResults = searchResultsFuture.get_result(
     ) if searchResultsFuture else []
     return searchResults
コード例 #4
0
ファイル: ajaxsearch.py プロジェクト: aaronlifshin/whysaurus
 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)
コード例 #5
0
 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))
コード例 #6
0
 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)
コード例 #7
0
ファイル: search.py プロジェクト: hcientist/whysaurus
    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))
コード例 #8
0
ファイル: search.py プロジェクト: aaronlifshin/whysaurus
 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))