Merge branch 'jinhai' into 'develop'

Fix compile error

See merge request jinhai/vecwise_engine!4
pull/3/head
jinhai 2019-03-20 21:23:53 +08:00
commit 5285fa20fc
1 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ class VectorEngine(object):
@staticmethod @staticmethod
def AddGroup(group_id): def AddGroup(group_id):
group = GroupTable.query.filter(GroupTable.group_name==group_id).first() group = GroupTable.query.filter(GroupTable.group_name==group_id).first()
if(group): if group:
return jsonify({'code': 1, 'group_name': group_id, 'file_number': group.file_number}) return jsonify({'code': 1, 'group_name': group_id, 'file_number': group.file_number})
else: else:
new_group = GroupTable(group_id) new_group = GroupTable(group_id)
@ -20,7 +20,7 @@ class VectorEngine(object):
@staticmethod @staticmethod
def GetGroup(group_id): def GetGroup(group_id):
group = GroupTable.query.filter(GroupTable.group_name==group_id).first() group = GroupTable.query.filter(GroupTable.group_name==group_id).first()
if(group): if group:
return jsonify({'code': 0, 'group_name': group_id, 'file_number': group.file_number}) return jsonify({'code': 0, 'group_name': group_id, 'file_number': group.file_number})
else: else:
return jsonify({'code': 1, 'group_name': group_id, 'file_number': 0}) # not found return jsonify({'code': 1, 'group_name': group_id, 'file_number': 0}) # not found
@ -53,9 +53,9 @@ class VectorEngine(object):
@staticmethod @staticmethod
def AddVector(group_id, vector): def AddVector(group_id, vector):
print(group_id, vector) print(group_id, vector)
file = FileTable.query.filter(and_(FileTable.group_name == group_id, FileTable.type == 'raw').first() file = FileTable.query.filter(and_(FileTable.group_name == group_id, FileTable.type == 'raw')).first()
if (file): if file:
if(file.row_number >= ROW_LIMIT): if file.row_number >= ROW_LIMIT:
# create index # create index
index_filename = file.filename + "_index" index_filename = file.filename + "_index"
CreateIndex(group_id, index_filename) CreateIndex(group_id, index_filename)