Esempio n. 1
0
 def load(self, info):
     info['apiRoot'].resource.route('GET', ('tags', ), getItemTags)
     Item().ensureIndex(([('meta.girder_item_tags', 1)], {
         'collation': {
             'locale': 'en_US',
             'strength': 1
         }
     }))
     # Pytest reloads the plugin for every test.
     # addSearchMode will break if called twice, so check if it's already been loaded.
     if search.getSearchModeHandler('item_tags') is None:
         search.addSearchMode('item_tags', search_handler)
Esempio n. 2
0
 def search(self, q, mode, types, level, limit, offset):
     """
     Perform a search using one of the registered search modes.
     """
     level = AccessType.validate(level)
     user = self.getCurrentUser()
     handler = getSearchModeHandler(mode)
     if handler is None:
         raise RestException('Search mode handler %r not found.' % mode)
     results = handler(query=q,
                       types=types,
                       user=user,
                       limit=limit,
                       offset=offset,
                       level=level)
     return results
Esempio n. 3
0
 def search(self, q, mode, types, level, limit, offset):
     """
     Perform a search using one of the registered search modes.
     """
     level = AccessType.validate(level)
     user = self.getCurrentUser()
     handler = getSearchModeHandler(mode)
     if handler is None:
         raise RestException('Search mode handler %r not found.' % mode)
     results = handler(
         query=q,
         types=types,
         user=user,
         limit=limit,
         offset=offset,
         level=level
     )
     return results