I suggest investigating this using a known example that does this, such as LatLonType and geodist(). LatLonType registers the field in a custom way too.
~ David Smiley Freelance Apache Lucene/Solr Search Consultant/Developer http://www.linkedin.com/in/davidwsmiley On Sun, Jun 8, 2014 at 7:54 AM, Costi Muraru <costimur...@gmail.com> wrote: > Hi guys, > > I have a custom FieldType that adds several IndexableFields for each > document. > I also have a custom function, in which I want to retrieve these indexable > fields. I can't seem to be able to do so. I have added some code snippets > below. > Any help is gladly appreciated. > > Thanks, > Costi > > public class MyField extends FieldType { > @Override > public final java.util.List<IndexableField> createFields(SchemaField > field, Object val, float boost) { > List<IndexableField> result = new ArrayList<IndexableField>(); > result.add(new Field(field.getName(), "field1", FIELD_TYPE)); > result.add(new Field(field.getName(), "123", FIELD_TYPE)); > result.add(new Field(field.getName(), "ABC", FIELD_TYPE)); > return result; > } > } > > > public class MyFunctionParser extends ValueSourceParser { > @Override > public ValueSource parse(FunctionQParser fqp) throws SyntaxError { > ValueSource fieldName = fqp.parseValueSource(); > return new MyFunction(fieldName); > } > } > > public class MyFunction extends ValueSource { > ... > @Override > public FunctionValues getValues(Map context, AtomicReaderContext > readerContext) throws IOException { > final FunctionValues values = valueSource.getValues(context, > readerContext); > LOG.debug("Value is: " + values.strVal(doc); *// prints "123" - > how can I retrieve the "field1" and "ABC" indexable fields as well?* > } > } > >