使用灵活搜索读取收集类型数据 [英] Reading collection type data using Flexible search

查看:87
本文介绍了使用灵活搜索读取收集类型数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用灵活搜索在Hybris中查看以集合类型存储的数据列表?

How to view the list of data stored in Collection type in Hybris using Flexible search?

我在某处读到它存储为PK,所以有可能以某种方式解析它吗?

I have read somewhere that it is stored as PKs so is it possible to parse it somehow?

推荐答案

"CollectionType基于Java Collection类."

"CollectionTypes are based on the Java Collection class."

CollectionType数据库字段的最大长度是有限的,因此,由于有许多记录,因此可能会导致其值被截断.此外,CollectionTypes的值以CSV格式而不是规范化的方式编写. Hybris建议尽可能在CollectionType上使用RelationTypes.

The maximum length of CollectionType database field is limited, so there may be a chance of getting its values truncated due to many records. In addition, the values of CollectionTypes are written in a CSV format and not in a normalized way. Hybris recommends using RelationTypes over CollectionType whenever possible.

集合如何存储值:

  1. 如果CollectionType包含AtomicTypes,则这些值将作为二进制字段存储在数据库中.
  2. 如果CollectionType存储项目的集合,则项目的主键(PK)以字符串形式( PK列表)存储在数据库中.
  1. If CollectionType contains AtomicTypes, the values are stored as binary fields in the database.
  2. If CollectionType stores collection of items, then items' Primary Keys (PKs) are stored in the database in string form (list of PKs).

优势:

  1. 由于一个CollectionType实例的所有值都存储为一个字段,因此读取和写入值的速度非常快,因为它是在单个数据库访问中完成的(尤其是使用缓存).

缺点:

  1. 如果一个集合包含很多PK,则该字段值可能达到数据库实现的最大字段长度,并且条目可能会被截断.

  1. If a collection contains a lot of PKs, the field value may reach the maximum length of field for the database implementation and entries may get truncated.

由于数据库条目仅包含PK,而不包含项目,因此无法直接在条目上运行数据库搜索.相反,您需要通过Java在内存中运行搜索,这通常比直接在数据库上搜索要慢.

As the database entry only contains the PKs, not the items, you cannot run database searches on the entries directly. Instead, you need to run searches in memory via Java, which is often slower than searching on the database directly.

这篇关于使用灵活搜索读取收集类型数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆