Hi Chris, Could you please send this to the java-user@lucene.apache.org list? I'll try to answer it there ... this way future Googlers can benefit.
Mike McCandless http://blog.mikemccandless.com On Tue, Feb 12, 2013 at 2:03 AM, Chris Bamford <chris.bamf...@talktalk.net> wrote: > Hi Mike, > > I have a question about your post "Searching relational content with Lucene's > BlockJoinQuery" > (http://blog.mikemccandless.com/2012/01/searching-relational-content-with.html). > I am > actually trying to use Lucene 4.0.0, so am having to translate your example > to the newer > ToParentBlockJoinQuery / ToChildBlockJoinQuery APIs. I have had some > success, but my > ultimate goal of combining the info from both child and parent hits is > eluding me. I > suspect I am missing something, but as yet haven't figured out what! > > In this scenario, let's say I have the following relationship: > > child 1 : ref:"100", content:"child 1", type:"C" > child 2 : ref:"200", content:"child 2", type:"C" > child 3 : ref:"300", content:"child 3", type:"C" > parent : ref:"400", content:"parent", type:"P" > > When one or more children are hit, I want that to be noted against the > parent, so ultimately I > can create a result object like: > > Result{ ref:400, content:"parent", matches: [100, 300] } // children 1 & 3 > were hit > > I have followed your example closely just replacing BlockJoinQuery with > ToParentBlockJoinQuery > and BlockJoinCollector with ToParentBlockJoinCollector. > Unfortunately I seem to be able to get either: > > Just the parent objects (with td=s.search(q, 10)) or just the children (with > the Collector), > but not both! > Am I to call search() twice (one returning TopDocs and the other GroupDocs > via the > Collector) and join them myself? Or does one of these calls return me both > types of > documents, grouped and sorted? > > I hope this makes sense. I'm happy to provide more detail if required. > > Thanks, > > - Chris > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org