Exemple #1
0
 def get(self):
     '''Suggest organizations'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['payload']['id'],
         'name': opt['text'],
         'score': opt['score'],
         'slug': opt['payload']['slug'],
         'image_url': opt['payload']['image_url'],
     } for opt in search.suggest(args['q'], 'org_suggest', args['size'])]
Exemple #2
0
 def get(self):
     '''Suggest users'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['payload']['id'],
         'fullname': opt['payload']['fullname'],
         'avatar_url': opt['payload']['avatar_url'],
         'slug': opt['payload']['slug'],
         'score': opt['score'],
     } for opt in search.suggest(args['q'], 'user_suggest', args['size'])]
Exemple #3
0
 def get(self):
     '''Suggest reuses'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['text'],
         'title': opt['payload']['title'],
         'score': opt['score'],
         'slug': opt['payload']['slug'],
         'image_url': opt['payload']['image_url'],
     } for opt in search.suggest(args['q'], 'reuse_suggest', args['size'])]
Exemple #4
0
 def get(self):
     '''Suggest geospatial zones'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['text'],
         'name': payload_name(opt['payload']),
         'code': opt['payload']['code'],
         'level': opt['payload']['level'],
         'keys': opt['payload']['keys'],
         'score': opt['score'],
     } for opt in search.suggest(args['q'], 'zone_suggest', args['size'])]
Exemple #5
0
 def get(self):
     '''Suggest datasets'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['payload']['id'],
         'title': opt['text'],
         'acronym': opt['payload'].get('acronym'),
         'score': opt['score'],
         'slug': opt['payload']['slug'],
         'image_url': opt['payload']['image_url'],
     } for opt in search.suggest(args['q'], 'dataset_suggest', args['size'])
             ]
Exemple #6
0
 def get(self):
     '''Suggest territories'''
     args = suggest_parser.parse_args()
     return [{
         'id': opt['payload']['id'],
         'name': opt['payload']['name'],
         'code': opt['payload']['code'],
         'level': opt['payload']['level'],
         'keys': opt['payload']['keys'],
         'score': opt['score'],
     } for opt in search.suggest(args['q'], 'territory_suggest',
                                 args['size'])]
Exemple #7
0
 def get(self):
     '''Suggest datasets'''
     args = suggest_parser.parse_args()
     return [
         {
             'id': opt['payload']['id'],
             'title': opt['text'],
             'score': opt['score'],
             'slug': opt['payload']['slug'],
             'image_url': opt['payload']['image_url'],
         }
         for opt in search.suggest(args['q'], 'dataset_suggest', args['size'])
     ]
Exemple #8
0
 def get(self):
     '''Suggest users'''
     args = suggest_parser.parse_args()
     return [
         {
             'id': opt['payload']['id'],
             'fullname': opt['payload']['fullname'],
             'avatar_url': opt['payload']['avatar_url'],
             'slug': opt['payload']['slug'],
             'score': opt['score'],
         }
         for opt in search.suggest(args['q'], 'user_suggest', args['size'])
     ]
Exemple #9
0
 def get(self):
     '''Suggest organizations'''
     args = suggest_parser.parse_args()
     return [
         {
             'id': opt['payload']['id'],
             'name': opt['text'],
             'score': opt['score'],
             'slug': opt['payload']['slug'],
             'image_url': opt['payload']['image_url'],
         }
         for opt in search.suggest(args['q'], 'org_suggest', args['size'])
     ]
Exemple #10
0
 def get(self):
     """Suggest users"""
     args = suggest_parser.parse_args()
     return [
         {
             "id": opt["payload"]["id"],
             "fullname": opt["payload"]["fullname"],
             "avatar_url": opt["payload"]["avatar_url"],
             "slug": opt["payload"]["slug"],
             "score": opt["score"],
         }
         for opt in search.suggest(args["q"], "user_suggest", args["size"])
     ]
Exemple #11
0
 def get(self):
     """Suggest organizations"""
     args = suggest_parser.parse_args()
     return [
         {
             "id": opt["text"],
             "name": opt["payload"]["name"],
             "score": opt["score"],
             "slug": opt["payload"]["slug"],
             "acronym": opt["payload"]["acronym"],
             "image_url": opt["payload"]["image_url"],
         }
         for opt in search.suggest(args["q"], "org_suggest", args["size"])
     ]
Exemple #12
0
 def get(self):
     '''Suggest geospatial zones'''
     args = suggest_parser.parse_args()
     return [
         {
             'id': opt['text'],
             'name': opt['payload']['name'],
             'code': opt['payload']['code'],
             'level': opt['payload']['level'],
             'keys': opt['payload']['keys'],
             'score': opt['score'],
         }
         for opt in search.suggest(args['q'], 'zone_suggest', args['size'])
     ]
Exemple #13
0
 def get(self):
     '''Suggest territories'''
     args = suggest_parser.parse_args()
     return [
         {
             'id': opt['payload']['id'],
             'name': opt['payload']['name'],
             'code': opt['payload']['code'],
             'level': opt['payload']['level'],
             'keys': opt['payload']['keys'],
             'score': opt['score'],
         }
         for opt in search.suggest(args['q'], 'territory_suggest', args['size'])
     ]
Exemple #14
0
 def get(self):
     '''Suggest file formats'''
     args = suggest_parser.parse_args()
     result = search.suggest(args['q'], 'format_suggest', args['size'])
     return sorted(result, key=lambda o: len(o['text']))
Exemple #15
0
 def get(self):
     '''Suggest tags'''
     args = parser.parse_args()
     q = normalize(args['q'])
     result = search.suggest(q, 'tag_suggest', args['size'])
     return sorted(result, key=lambda o: len(o['text']))
Exemple #16
0
 def get(self):
     '''Suggest tags'''
     args = parser.parse_args()
     q = normalize(args['q'])
     result = search.suggest(q, 'tag_suggest', args['size'])
     return sorted(result, key=lambda o: len(o['text']))
Exemple #17
0
 def get(self):
     '''Suggest file formats'''
     args = suggest_parser.parse_args()
     result = search.suggest(args['q'], 'format_suggest', args['size'])
     return sorted(result, key=lambda o: len(o['text']))
Exemple #18
0
 def get(self):
     """Suggest tags"""
     args = parser.parse_args()
     result = search.suggest(args["q"], "tag_suggest", args["size"])
     return sorted(result, key=lambda o: len(o["text"]))