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 Costi Muraru <co...@gmail.com> on 2014/06/19 09:27:52 UTC

Store Java object in field and retrieve it in custom function?

Hi,

I'm trying to save a Java object in a binary field and afterwards use this
value in a custom solr function.
I'm able to put and retrieve the Java object in Base64 via the UI, but I
can't seem to be able to retrieve the value in the custom function.

In the function I'm using:
termsIndex = FieldCache.DEFAULT.getTermsIndex(reader, fieldName);
termsIndex.get(doc, spare);
Log.debug("Length: " + spare.length);

The length is always 0. It works well if the field type is not binary, but
string.
Do you have any tips?

Thanks,
Costi

Re: Store Java object in field and retrieve it in custom function?

Posted by Erick Erickson <er...@gmail.com>.
Silly question perhaps, but is your binary field type _indexing_ the
content? You're pulling the values from the indexed terms, how is your
binary field type analyzing the input on its way to the index?

Since it's base64, why not just index it as a string type? Do you even
need binary here at all? I confess that I don't know the innards of
the binary type so I'm side-stepping the issue :)...

Erick

On Thu, Jun 19, 2014 at 12:27 AM, Costi Muraru <co...@gmail.com> wrote:
> Hi,
>
> I'm trying to save a Java object in a binary field and afterwards use this
> value in a custom solr function.
> I'm able to put and retrieve the Java object in Base64 via the UI, but I
> can't seem to be able to retrieve the value in the custom function.
>
> In the function I'm using:
> termsIndex = FieldCache.DEFAULT.getTermsIndex(reader, fieldName);
> termsIndex.get(doc, spare);
> Log.debug("Length: " + spare.length);
>
> The length is always 0. It works well if the field type is not binary, but
> string.
> Do you have any tips?
>
> Thanks,
> Costi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org