SOLR中多值字段的顺序是否可靠?
我有一个索引的多价字段。如果我添加并行的多值字段,是否可以使用相同的订单可靠?
考虑使用此CSV和分隔器|
:
ID,Name,Number
988,Sixth|Second|Third,6|2|3
989,Fifth|Fourth|First,5|4|1
如果我通过ID
(不搜索)获取记录,我可以确保两个字段的数组始终处于原始匹配顺序中?
{
"doc":
{
"ID":988,
"Name":["Sixth",
"Second",
"Third"]},
"Number":[6,
2,
3]}}
I have an indexed multi-value field. If I add a parallel multi-value field, is it reliable to have the same order?
Consider this CSV and separator |
:
ID,Name,Number
988,Sixth|Second|Third,6|2|3
989,Fifth|Fourth|First,5|4|1
If I get the records by id
(not search), can I be sure that the arrays of two fields are always in the original matching order?
{
"doc":
{
"ID":988,
"Name":["Sixth",
"Second",
"Third"]},
"Number":[6,
2,
3]}}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,订单是确定性和稳定的。您可以安全地假设多值字段的序列保持完整。此后,该帖子在邮件列表中详细介绍了此信息。
无法保证字段的顺序 - IE“ number”可以在“名称”之前出现,但是在内部(mulivalued零件)中,值将以与它们相同的顺序返回该值被索引。
自2008年以来,我们一直在Solr上运行应用程序,这取决于这种行为,这从来都不是问题。
如果您需要在一个字段中知道[0]在另一个字段中对应[0]等。作为一个字段,只需索引其他字段(而不是存储)以使应用程序级别代码更简单。
Yes, the order is deterministic and stable. You can safely assume that the sequence of multivalued fields is kept intact. The post detailing this on the mailing list has since disappeared.
There is no guarantee about the ordering of the fields - i.e. "Number" can come before "Name", but internally in the field (the mulivalued part) the values will be returned in the same order as they were indexed.
We've been running applications on Solr since 2008 that depend on this behavior and it has never been an issue.
If there's many fields where you need to know that [0] in one field corresponds to [0] in another field, etc., it might be more useful to add a stored only (not indexed, etc.) JSON representation of the structure as a field and just index the other fields (and not store them) to make the application level code simpler.