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 Ramprakash Ramamoorthy <r4...@gmail.com> on 2013/01/18 15:58:16 UTC

Inner join in lucene

Dear all,

         I know, lucene is no relational database, but spare me. I need to
run a search across an index, and find fields that have a common equal
value, where the common value is unknown(to be determined at run time).

         An outright sql query would be *SELECT * from table1 where
table1.field1=table2.field3=table3.field2; *

*        *How do I proceed upon this? Get distinct values (if at all it is
possible) for a field and iterate the query across fields is the only
solution? Or is there an aesthetic way?

         Please to help. Thanks in advance.

--
With thanks and regards,
Ramprakash Ramamoorthy,
SASTRA University,
India.

Re: Inner join in lucene

Posted by Ramprakash Ramamoorthy <yo...@gmail.com>.
On Fri, Jan 18, 2013 at 9:05 PM, Apostolis Xekoukoulotakis <
xekoukou@gmail.com> wrote:

> You can put those fields as a DocValue type of field. They are optimized
> for use during search(or join in this case).
>
> Then create a collector that collects the documents which have the same
> value in those fields.
>
> Have other more experienced comment though before you start implementing
> it.
>
> Thank you Apostolis,

          That is definitely giving me some headstarts. Will check with
this and also update this thread, when I infer.

>
>
2013/1/18 Ramprakash Ramamoorthy <r4...@gmail.com>
>
> > Dear all,
> >
> >          I know, lucene is no relational database, but spare me. I need
> to
> > run a search across an index, and find fields that have a common equal
> > value, where the common value is unknown(to be determined at run time).
> >
> >          An outright sql query would be *SELECT * from table1 where
> > table1.field1=table2.field3=table3.field2; *
> >
> > *        *How do I proceed upon this? Get distinct values (if at all it
> is
> > possible) for a field and iterate the query across fields is the only
> > solution? Or is there an aesthetic way?
> >
> >          Please to help. Thanks in advance.
> >
> > --
> > With thanks and regards,
> > Ramprakash Ramamoorthy,
> > SASTRA University,
> > India.
> >
>
>
>
> --
>
>
> Sincerely yours,
>
>      Apostolis Xekoukoulotakis
>

Re: Inner join in lucene

Posted by Apostolis Xekoukoulotakis <xe...@gmail.com>.
You can put those fields as a DocValue type of field. They are optimized
for use during search(or join in this case).

Then create a collector that collects the documents which have the same
value in those fields.

Have other more experienced comment though before you start implementing it.


2013/1/18 Ramprakash Ramamoorthy <r4...@gmail.com>

> Dear all,
>
>          I know, lucene is no relational database, but spare me. I need to
> run a search across an index, and find fields that have a common equal
> value, where the common value is unknown(to be determined at run time).
>
>          An outright sql query would be *SELECT * from table1 where
> table1.field1=table2.field3=table3.field2; *
>
> *        *How do I proceed upon this? Get distinct values (if at all it is
> possible) for a field and iterate the query across fields is the only
> solution? Or is there an aesthetic way?
>
>          Please to help. Thanks in advance.
>
> --
> With thanks and regards,
> Ramprakash Ramamoorthy,
> SASTRA University,
> India.
>



-- 


Sincerely yours,

     Apostolis Xekoukoulotakis