On 6/28/2018 8:15 AM, Markus Jelsma wrote:
> Ah, forgot about that thread. But yes, it makes sense and we used it as such 
> in production. But the test was never updated, never failed, until 7.4.0 came 
> around. So it is confusing why the tests didn't fail, and confusing why it 
> does in 7.4.0. Any ideas why now?

On a second look at what Hoss said previously, I think I understand it
now.  Because the name provided when using a transformer is a display
name and not actually a field name, that field is not requested
explicitly from the index, so there's nothing for the transformer to
work on.  But when * is used, the field IS requested, and it works.

So the recommendation was to have the transformer have a parameter to
indicate what source field to use, and override getExtraRequestFields()
to request that field.

RawValueTransformerFactory also shows how to use the display identifier
as the source field name if the parameter indicating the source field is
not present.  This is in the factory's create method.

If you haven't already (and it sounds like maybe you have), I would
recommend you use the same approach as RawValueTransformerFactory, which
would explicitly request the field with the same name as the display if
the parameter for the source field is missing.

I have no idea why your test code would work properly and suddenly break
in 7.4.0.  Is it possible that when you upgraded Solr in the test
environment, that somehow it started loading an old version of the
transformer that doesn't have the changes you made for production back
in 2016?

Thanks,
Shawn

Reply via email to