I’ve been reading answers around this problem but I wanted to make sure that there is another way out of my problem. The thing is that the solution shouldn’t be on index-time, involve indexing a new field or changing this multi-valued field to a single-valued one.
Problem: I need to run a custom function with some fields but I see that it’s not possible to get the value (first value in this case) of a multivalued field. “title”, in my case, is a multi-valued field.
When I try a Solr function:
if(exists(title),strdist(title, “string1"),0).
This throws the “can’t use FieldCache on a multivalued field” error. The same happen when I run a custom function. I can't access a multi-valued field.
Solutions that doesn’t work for me:
Keep a copy of the value into a non-multi-valued field, using an update processor: This involves indexing a new field.
Change the field to multiValued=false: This involves using a single-valued field. I will be indexing new data in the future and I need some fields to be multi-valued but I also need to work with them.
Thanks in advance, I spent a lot of time with this without a solution. I’m using Solr 4.10.
Note: I know how to parse a multivalue field but the thing is that Solr doesn't even access to my function, it throws the previous error (looks like it does this on his source function checkFieldCacheSource)