Skip to content

Conversation

@rlskoeser
Copy link
Contributor

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.

@rlskoeser
Copy link
Contributor Author

Updated pull request with a fix for join queries when combined with other searches. Also added join logic to a few other places I missed (nonzero check, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant