当前位置: 首页 > news >正文

做班级相册网站的目的意义酒店的网站建设方案

做班级相册网站的目的意义,酒店的网站建设方案,网站商城建设基本流程,网站空间多大合适在处理插入milvus数据时,设置了字段长度为512. 明明考虑了预留,插入的数据中没有这么长的,但还是会有报错 类似:MilvusException: (code0, messagethe length (564) of 78th string exceeds max length (512) 查找max(len(x) for …

在处理插入milvus数据时,设置了字段长度为512. 明明考虑了预留,插入的数据中没有这么长的,但还是会有报错 类似:MilvusException: (code=0, message=the length (564) of 78th string exceeds max length (512)
查找max(len(x) for x in temp_list)之类  都没有超过512过,也没超过256过,不知道哪里的数据有问题..
反复截段文本等测试后发现,例如用len(x)看到的字符串长度是10,但保存进milus的长度,并不是..

举例,把数据库长度设为一个小值16:
FieldSchema(name="question", dtype=DataType.VARCHAR, auto_id=False, max_length=16)

再把数据缩到只有一行 测试结果插入成功:

line contents is : 你好呀你好 and length is 5
Batches: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.02s/it]
index handle result: Status(code=0, message=)
insert result: (insert count: 1, delete count: 0, upsert count: 0, timestamp: 449735609509740549, success count: 1, err count: 0)

再增加一点文字长度 就报错了:

line contents is : 你好呀你好呀 and length is 6
Batches: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.03it/s]
index handle result: Status(code=0, message=)
[2024-05-13 20:59:27,915 decorators.py:134                              ERROR] RPC error: [batch_insert], <MilvusException: (code=0, message=the length (18) of 0th string exceeds max length (16))>, <Time:{'RPC start': '2024-05-13 20:59:27.912751', 'RPC error': '2024-05-13 20:59:27.915058'}>
Traceback (most recent call last):
  File "/root/temp_dir/run_task.py", line 55, in <module>
    XXX().create_insert_vector_db()
  File "/root/temp_dir/app/service/vector_db/xx_pre_handle.py", line 63, in create_insert_vector_db
    ).get_or_create_db(fields, description, "possible_question_embeddings", entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 23, in get_or_create_db
    return self.create_and_insert(fields, description, index_field_name, entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 28, in create_and_insert
    self.insert_db(entities)
  File "/root/temp_dir/app/service/vector_db/milvus_db.py", line 40, in insert_db
    insert_result = self.collection.insert(entities)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/orm/collection.py", line 497, in insert
    res = conn.batch_insert(
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 135, in handler
    raise e from e
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 131, in handler
    return func(*args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 170, in handler
    return func(self, *args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 110, in handler
    raise e from e
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/decorators.py", line 74, in handler
    return func(*args, **kwargs)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 566, in batch_insert
    raise err from err
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 560, in batch_insert
    check_status(response.status)
  File "/root/tmp/venv_dir/1_text_simi/lib/python3.10/site-packages/pymilvus/client/utils.py", line 54, in check_status
    raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=0, message=the length (18) of 0th string exceeds max length (16))>


所以,可能是因为UTF-8或其他编码的原因,一些非ASCII字符可能被编码成多个字节 以保存进milvus。
所以,解决方案是 建表时FieldSchema中把max_length 设置为4倍或其他倍数于预期的最大长度。


 

http://www.yayakq.cn/news/203697/

相关文章:

  • vs 2008 建立网站淮南官网
  • 如何自己做优惠券网站中国企业网中国商报
  • 济南网站维护公司网站怎么做房源
  • 中山大兴网站建设长春seo公司
  • 湟源县网站建设怀化市住房与城乡建设厅网站
  • 营销型定制网站芜湖先锋网站两学一做
  • 如何 做镜像网站php网站开发教程培训
  • 汽车用品东莞网站建设珠海网站建设q.479185700強
  • 建设网站的公司排名百度快速收录seo工具软件
  • 网站界面是什么做的wordpress remove_query_arg
  • 回收网站怎么做详情页模板 套用
  • 昆明手机网站开发企业管理培训课程班
  • 企业建设H5响应式网站的5大好处中国新闻社官方网站
  • 弹簧东莞网站建设如何设置网站根目录
  • 厦门旅游网站建设商务网站建设流程
  • 资兴市网站建设哪个好青海企业网站建设公司
  • 成都装饰网站建设广州哪里能看海
  • 六安网站制作公司价格成都品牌网站建设
  • 浙江人工智能建站系统软件怎么做繁体字网站
  • 湖南好搜网站建设公众号怎么引流推广
  • 如何提高一个网站安卓手机本地视频播放器
  • 子页网站设计怎么做弹幕视频网站
  • 国外著名购物网站排名网站设计制作的服务和质量
  • 宿迁建站网网站模板之家
  • 引蜘蛛网站wordpress页面跳舞
  • 网站初期seo怎么做上海市工商局官网
  • 自助建站软件凡客软件下载
  • 湖南还没有建网站的企业有保障的广州网站建设
  • 门户类网站备案wordpress入门
  • 模块化html5网站开发建网站怎么做