Пример #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'])]
Пример #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'])]
Пример #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'])]
Пример #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'])]
Пример #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'])
             ]
Пример #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'])]
Пример #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'])
     ]
Пример #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'])
     ]
Пример #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'])
     ]
Пример #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"])
     ]
Пример #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"])
     ]
Пример #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'])
     ]
Пример #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'])
     ]
Пример #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']))
Пример #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']))
Пример #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']))
Пример #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']))
Пример #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"]))