def _additional_query_check(self): if not is_postgre(): raise DbNotSupported, 'Only Postgre 8.3+' fts_config = self.engine._get_ts_config() # cursor = connection.cursor() # cursor.execute('SELECT count(*) as "cnt" FROM "pg_catalog"."pg_ts_config" WHERE "cfgname" = %s', # (fts_config, ) # ) # res = cursor.fetchone() # if res is None: # raise DbNotSupported, 'FTS configuration "%s" not supported at your database' % fts_config # # cursor = connection.cursor() # cursor.execute('SELECT count(*) as "cnt" FROM "pg_catalog"."pg_ts_config" WHERE "cfgname" = %s', # (fts_config, ) # ) cursor = self._get_connection().cursor() cursor.execute( "SELECT numnode(plainto_tsquery(%s, %s))", (fts_config, self._get_fts_query()) ) res = cursor.fetchone() if res is None or int(res[0]) < 1: raise TooShortQuery
def _additional_query_check(self): #TODO mysql and sqlite support if not is_postgre(): raise DbNotSupported, 'SQLite and MySql aren\'t supported yet, will be in future releases'