tow/sunburnt — pull request #88 by rlskoeser (2014-05-01 23:01:37+00:00)
Title: Solr4 join support

Support for Solr 4 join queries based on the examples at http://wiki.apache.org/solr/Join

I added the join logic based on how range queries are handled in the LuceneQuery class.

I added some test cases and documentation. I wasn't sure how to test the error handling (e.g. attempting to join on fields not defined in the schema) as I couldn't find any tests that were similar enough to adapt.

I haven't used join queries very extensively yet, so it's entirely possible I'm assuming something I shouldn't or oversimplifying, but this code does successfully generate working join queries against actual my data.

As far as I can tell, the join query syntax only allows for one associated search term, but the code I added doesn't currently enforce this. If more than one search term is added to the join they will be added to the query but not given the context of the join. Should it not allow more than one term? Or perhaps it could automatically generate separate join requests if there are multiple terms - this way calling code wouldn't have to call join method repeatedly for multiple filters on the same join.

FYI, it looks like my editor settings have stripped out some whitespace and introduced some changes that aren't entirely relevant. My apologies for that, let me know if you want me to do something about it.