简体   繁体   English

按solr中多值字段的特定值排序

[英]sorting by specific value of multivalued field in solr

I Have a Solr index that stores dates in a multivalued field for each document. 我有一个Solr索引,该索引将日期存储在每个文档的多值字段中。

I need to have the ability to search for a date range (done that), but also sort the result set by date where the date is the first date of the multivalued field that falls within the range. 我需要具有搜索日期范围(完成该操作)的功能,还需要按日期对结果集进行排序,其中日期是该范围内多值字段的第一个日期。

If I try to use a function for sorting it will tell me that it can not use the Field Caceh on multivalued fields. 如果我尝试使用函数进行排序,它将告诉我不能对多值字段使用Field Caceh。

Is it possible to maybe have a function fill a field on the query and then sort by that, or another option, or would the only option be to use a join, order by the join and then field collapse. 是否可以有一个函数填充查询中的一个字段,然后按该字段或另一个选项进行排序,或者唯一的选择是使用联接,按联接排序,然后字段折叠。

I really can't use SQL due to the complexity of the search and the number of joins, so was hoping there was a way I could complete this without falling back to SQL-like paradigms. 由于搜索的复杂性和联接的数量,我真的不能使用SQL,因此希望有一种方法可以完成此过程而又不退回到类似SQL的范式。

You can try to add multiple documents to the index, each with a single value for the document. 您可以尝试将多个文档添加到索引,每个文档都有一个单独的值。 Then, sort by the date and group by the docid. 然后,排序的日期和由docID的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM