Inmy lastpost I described a known limitationof
This is now fixed! Ijust committeda new query,
You use it just like
Using songs and albums as an example: imagine you index eachsong (child) and album (parent) as separate documents in a singledocument block. With
BlockJoinQuery
: it joins in only one direction (fromchild to parent documents). This can be a problem because someapplications need to join in reverse (from parent to child documents)instead.This is now fixed! Ijust committeda new query,
ToChildBlockJoinQuery
, to perform the joinin the opposite direction. I also renamed the previous queryto ToParentBlockJoinQuery
.You use it just like
BlockJoinQuery
, except in reverse:it wraps any other Query
matching parent documents andtranslates it into a Query
matching child documents. Theresulting Query
can then be combined with other queriesagainst fields in the child documents, and you can then sort by childfields as well.Using songs and albums as an example: imagine you index eachsong (child) and album (parent) as separate documents in a singledocument block. With
ToChildBlockJoinQuery
, you can nowrun queries like:or
albumName:thunder AND songName:numb
Any query with constraints against album and/or song fields will work,and the returned hits will be individual songs (not grouped).
albumName:thunder, sort by songTitle
ToChildBlockJoinQuery
will be available in Lucene 3.6.0and 4.0.