lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costi Muraru <costimur...@gmail.com>
Subject How to retrieve entire field value (text_general) in custom function?
Date Wed, 11 Jun 2014 15:30:59 GMT
I have a text_general field and want to use its value in a custom function.
I'm unable to do so. It seems that the tokenizer messes this up and only a
fraction of the entire value is being retrieved. See below for more details.

 <doc> <str name="id">1</str> <str name="field_t">term1 term2 term3</str>
<
long name="_version_">1470628088879513600</long></doc> <doc> <str
name="id">
2</str> <str name="field_t">x1 x2 x3</str> <long name="_version_">
1470628088907825152</long></doc>


public class MyFunction extends ValueSource {

    @Override
    public FunctionValues getValues(Map context, AtomicReaderContext
readerContext) throws IOException {
        final FunctionValues values = valueSource.getValues(context,
readerContext);
        return new StrDocValues(this) {

            @Override
            public String strVal(int doc) {
                return values.strVal(doc);
            }
        };
    }
}

Tried with SOLR 4.8.1.

Function returns:
- term3 (for first document)
- null (for the second document)

I want the function to return:
- term1 term2 term3 (for first document)
- x1 x2 x3 (for the second document)

How can I achieve this? I tried to google it but no luck. I also looked
through the SOLR code but could not find something similar.

Thanks!
Costi

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message