Hi,
You need to index this field with a different analyzer under a different name. In Solr, this should be a StrField or a field with KeywordTokenizer. For your use-case (random access to values), the field should ideally be a docvalues field. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de <http://www.thetaphi.de/> eMail: [email protected] From: Costi Muraru [mailto:[email protected]] Sent: Wednesday, June 11, 2014 5:31 PM To: [email protected]; [email protected] Subject: How to retrieve entire field value (text_general) in custom function? 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
