BlockJoinQuery: it joins in only one direction (from child to parent documents). This can be a problem because some applications need to join in reverse (from parent to child documents) instead.
This is now fixed! I just committed a new query,
ToChildBlockJoinQuery, to perform the join in the opposite direction. I also renamed the previous query to
You use it just like
BlockJoinQuery, except in reverse: it wraps any other
Querymatching parent documents and translates it into a
Querymatching child documents. The resulting
Querycan then be combined with other queries against fields in the child documents, and you can then sort by child fields as well.
Using songs and albums as an example: imagine you index each song (child) and album (parent) as separate documents in a single document block. With
ToChildBlockJoinQuery, you can now run queries like:
albumName:thunder AND songName:numbor
albumName:thunder, sort by songTitleAny query with constraints against album and/or song fields will work, and the returned hits will be individual songs (not grouped).
ToChildBlockJoinQuerywill be available in Lucene 3.6.0 and 4.0.