You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by kiwi clive <ki...@yahoo.com> on 2012/04/04 19:37:31 UTC

Re: createJoinQuery use

Hi Martijn,

Thank you for responding so quickly. I found my reply was stuck in my drafts folder so apologies for not getting back sooner.  I'm trying to search and join across two disparate document types that have some common features. Your response confirms what I was looking into.

My understanding about the join query is that it does a 'search' for the from field and then uses those results as part of the second or 'real' query. The first of these 'queries' I believe is an internal mechanism that does not return docs, but smaller more efficient objects.

So if I wanted to search across two different types of document in one index with some fields on one doc type and some on the other, I effectively need to perform 4 queries.

This is kind of where I was coming from.

Thanks,
Clive



________________________________
 From: Martijn v Groningen <ma...@gmail.com>
To: java-user@lucene.apache.org 
Sent: Thursday, March 29, 2012 3:23 PM
Subject: Re: createJoinQuery use
 
It is only possible to join on one side at the same time.
You mean something like this:
Query fromQuery = JoinUtil.createJoinQuery("from", "to", actualQuery,
indexSearcher);
Query toQuery = JoinUtil.createJoinQuery("to", "from", actualQuery,
indexSearcher);

And then use a boolean query to combine it? What is it you want to achieve?

Martijn

On 29 March 2012 14:04, kiwi clive <ki...@yahoo.com> wrote:

> Hi Chaps,
>
> JoinUtil.createJoinQuery() specifies a Query for the from side of the join.
>
>
> Is it possible to query over both sides of the join (while still providing
> the two join fields) ? If not, what is the recommended best practice to do
> this?
>
> Thanks, and apologies for the dumb questions
> C




-- 
Met vriendelijke groet,

Martijn van Groningen