You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Fernando Agüero <fj...@gmail.com> on 2015/05/20 11:45:00 UTC

Problem using a function with a multivalued field

Hi everyone,

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” is a multi-valued field.


See:
if(exists(title),strdist(title, “string1"),0).


This throws the “can’t use FieldCache on a multivalued field” error.


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.

Re: Problem using a function with a multivalued field

Posted by Erick Erickson <er...@gmail.com>.
bq: Keep a copy of the value into a non-multi-valued field, using an
update processor:  This involves indexing a new field

Why can't you do this? You can't re-index the data perhaps? It's by
far the easiest solution....

Best,
Erick

On Wed, May 20, 2015 at 2:45 AM, Fernando Agüero <fj...@gmail.com> wrote:
> Hi everyone,
>
> 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” is a multi-valued field.
>
>
> See:
> if(exists(title),strdist(title, “string1"),0).
>
>
> This throws the “can’t use FieldCache on a multivalued field” error.
>
>
> 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.