Github user dsmiley commented on the issue:

    https://github.com/apache/lucene-solr/pull/443
  
    Oh right; we'd get an infinite loop as the ChildDocTransformerFactory is 
already being called by SolrReturnFields!  Ouch!
    
    Sorry but I don't like your solution of trying to parse/strip the child 
transformer "fl"; it's very error-prone to do such things.
    
    Lets define a ThreadLocal<Boolean> that allows us to know if we're being 
asked to create this transformer from within a recursive call to 
SolrReturnFields.  When we see this happening, we can return a no-op 
transformer (see RawValueTransformerFactory.NoopFieldTransformer which could be 
made public and moved to an inner class of DocTransformer).  This thread local 
would be set & cleared in a try-finally, and this logic would be in some 
utility method to keep it from being distracting to the caller.  In general I 
avoid ThreadLocals as it's a singleton design pattern which is usually bad, but 
it can be used sparingly/judiciously.
    
    BTW it appears that doc transformers will not be executed on the child 
docs.  The transformer is not invoking them, and I suspect they won't be 
invoked on the way out to the client.  Can you check/test if this is true?  If 
I'm correct, this is a pre-existing bug/limitation that would be good to mark 
as a TODO; or you can try to address here since it's related (since you before 
couldn't specify what 'fl' was therefore it wasn't possible to specify a 
transformer until now).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to