Hi all.

We have a custom QueryNode in our parser which creates a subclass of
PhraseQuery.

I find since updating to 5.3.1, SlopQueryNodeBuilder is replacing it
with a fresh PhraseQuery. Previously, it used to just set the slop on
the existing one, which allowed our custom subclasses straight
through.

The code in there looks a bit esoteric because it appears to build a
second instance of exactly the same query. One might think that it's
trying to clone it to avoid sharing a mutable Query object between two
places, but then in the other branch of the if-else it's letting
MultiPhraseQuery through unharmed, so I'm not really sure what this
change was supposed to achieve.

Needless to say we'll be cloning the old version into our own repo and
replacing it with that.

I'm not sure whether this is considered a bug, but perhaps a good
practice is that if you're going to create a brand new instance, you
check whether the thing you got passed is of that exact class first,
to avoid impacting people who are subclassing your classes.

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to