I'm trying to use BJPQP and ran into a few little gotchas that I'd like to share with y'all in case you have any advice.

First I ran into an NPE that probably should be handled better - maybe just an exception with a better message. The framework I'm working in makes it slightly annoying to use localParams syntax (I have to bypass special-character escaping in the client framework), so I thought I'd set defType=parent and pass the "which" as a global parameter, but if you try this you get an NPE since the QParser expects "which" to be passed in as a local param. It's probably not really a sane use case since you have to use localParams to get your default qparser instantiated in that case anyway, so why would you do it? Still - it would be good to report a clearer exception to the user.

Then I got my query working, but results were coming back in a funky order. I realized that the client doc scores were being thrown away -- BJPQP is hard-coded to use ScoreMode.None. So then I went to subclass the QParser (and plugin) to override the score mode -- createQuery is protected, which would seem to make this convenient to do this, but the class itself (BlockJoinParentQParser) is package private. Then I thought I'd just put my class in the same package, but this fails at runtime since it's loaded by a different class loader. argh. I would have to copy and fork the whole class to get this working.

I guess that's what I'll do, but this should be easier. Am I missing something? Is there another way to get a scoring ToParentBlockJoinQuery in Solr?

Thanks

-Mike

Reply via email to