2

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. 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?

James
  • 523
  • 4
  • 19
  • Check these http://stackoverflow.com/questions/17648021/solr-multivalued-date-range-from-two-separate-field-as-sub-entity http://stackoverflow.com/questions/8089947/solr-and-query-over-multiple-fields – Zain Aftab Aug 25 '15 at 06:49
  • Thank you for your response. But in those links I see that they have separate fields. But I have two values in one(string). It's totally different. I told that in my case "type:type1; YEAR:2008" is one string field – James Aug 25 '15 at 06:55

1 Answers1

3

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 (e.g. it is used in processing the search results), create two new fields (e.g. 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.

Jozef Chocholacek
  • 2,874
  • 2
  • 20
  • 25
  • Thank you) Just needed a confirmation from another person to show it to my boss. – James Aug 26 '15 at 06:57
  • For multi-valued fields, I think the splitting won't help - you can't get around the hell-of-a-lot of coding, IMO. Suppose you have both of the values "type:one; YEAR:2011" and "type:two; YEAR:2004" present for one document. Splitting would add "type:one" and "type:two" to part 1 and "2004" and "2011" to part 2. Searching for part1:"type:one*" AND part2:["*YEAR:2000" TO "*YEAR:2005"] will then find your document, even if it shouldn't. But maybe I'm missing something. – user625488 Oct 08 '15 at 10:04