简体   繁体   English

文本字段中的Solr范围查询

[英]Solr range query in text field

I have a multi valued field. 我有一个多值字段。 The content looks this way 内容看起来像这样

multi_field:"type:type1; YEAR:2008"

I want to be able to make range requests based on YEAR substring. 我希望能够根据YEAR子字符串发出范围请求。 I cannot understand if I can perform this kind of range queries. 我无法理解是否可以执行这种范围查询。 I want to have something like this. 我想要这样的东西。 q=multi_field:"type:type1;*" AND multi_field:"*YEARS:[2005 TO 2010]*"

Is it possible? 可能吗? I know it looks horrible. 我知道这看起来很可怕。 But is there any way I can get it? 但是我有什么办法吗?

No, it is not possible (at least without a hell-a-lot of coding). 不,这是不可能的(至少没有大量的编码)。 The easiest way should be to fix the indexing code to split the field into two separate fields. 最简单的方法应该是修复索引代码,以将字段分为两个单独的字段。 If you need to keep the original multi_field available (eg it is used in processing the search results), create two new fields (eg multi_field_part1 and multi_field_part2 ), do the search over the new fields ( q=multi_field_part1:type1 AND multi_field_part2:[2005 TO 2010] ), but use the old one in results. 如果需要保持原始的multi_field可用(例如,用于处理搜索结果),请创建两个新字段(例如, multi_field_part1multi_field_part2 ),然后在新字段上进行搜索( q=multi_field_part1:type1 AND multi_field_part2:[2005 TO 2010] ),但在结果中使用旧的。

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

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