Smells like an XY problem ... Can you please describe what your end goal is in writing a custom function, and what you would do with things like the "name" field inside your funciton?
In general, accessing stored field values for indexed documents ca be prohibitively expensive, it rather defeats the entire point of the inverted index data structure. If you help us understand what your goal is, people may be able to offer performant suggestions. https://people.apache.org/~hossman/#xyproblem XY Problem Your question appears to be an "XY Problem" ... that is: you are dealing with "X", you are assuming "Y" will help you, and you are asking about "Y" without giving more details about the "X" so that we can understand the full issue. Perhaps the best solution doesn't involve "Y" at all? See Also: http://www.perlmonks.org/index.pl?node_id=542341 : Date: Mon, 9 Dec 2013 20:24:15 +0530 : From: Mukundaraman valakumaresan <muk...@8kmiles.com> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Getting Solr Document Attributes from a Custom Function : : Hi All, : : I have a written a custom solr function and I would like to read a property : of the document inside my custom function. Is it possible to get that using : Solr? : : For eg. inside the floatVal method, I would like to get the value of the : attribute "name" : : public class CustomValueSource extends ValueSource { : : @Override : public FunctionValues getValues(Map context, : AtomicReaderContext readerContext) throws IOException { : return new FloatDocValues(this) { @Override public float floatVal(int doc) : { : /******* : getDocument(doc).getAttribute("name") : : ********/ }}} : : Thanks & Regards : Mukund : -Hoss http://www.lucidworks.com/