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 Trupti Ghuge <tr...@TechMahindra.com> on 2012/08/27 12:01:45 UTC

Lucene join

Hi,

 

I am new to Lucene. I have a complex query where I need to join more
than two tables and have different filtering criteria on it.

Is it possible to use Lucene for this ?

 

For example , my query is as follows(there is no foreing key relation on
the tables):

 

Select x.id from tablex x, tabley y where (x.id=y.testid and
y.typeid=7),.....

 

There are more filter queries ahead.

 

Waiting for your reply.

 

 

Thanks & Regards, 

Trupti Ghuge 

 

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/tim/disclaimer.html">http://tim.techmahindra.com/tim/disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================

Re: Lucene join

Posted by Martijn v Groningen <ma...@gmail.com>.
Lucene isn't a relation database. However there are some methods to
have a relational like search:
1) Index time joins:
http://blog.mikemccandless.com/2012/01/searching-relational-content-with.html
2) Query time joins:
http://www.searchworkings.org/blog/-/blogs/query-time-joining-in-lucene

Martijn

On 27 August 2012 20:29, Stephen Howe <si...@gmail.com> wrote:
> Trupti,
>
> Looking over your sample query, that looks like you're trying to do a SQL
> query against a database instead of a Lucene query. If you're going against
> a SQL database, Lucene isn't a good tool for the problem you've outlined.
> If you're using SQL, you can do multiple joins to link multiple tables
> together. For instance, SELECT * FROM foo INNER JOIN bar ON foo.pid =
> bar.idINNER JOIN foobar ON bar.oid = foobar.uid WHERE
> foo.name != 'name'; lets you perform an inner join across three distinct
> tables.
>
> If you have a collection of text documents, for instance sales reports, and
> want to find all the unstructured text documents mentioning the words
> "BigClient", then Lucene offers a good solution to the problem. You could
> create a simple term query that finds only those documents in the index
> with the term "BigClient". The query would look like this (+BigClient) when
> you ran the toString method after building the query.
>
> If you're using a SQL database, Lucene isn't a good solution to the problem
> you specified.
>
> Hope it helps!
> Stephen
>
> On Mon, Aug 27, 2012 at 6:01 AM, Trupti Ghuge <tr...@techmahindra.com>wrote:
>
>> Hi,
>>
>>
>>
>> I am new to Lucene. I have a complex query where I need to join more
>> than two tables and have different filtering criteria on it.
>>
>> Is it possible to use Lucene for this ?
>>
>>
>>
>> For example , my query is as follows(there is no foreing key relation on
>> the tables):
>>
>>
>>
>> Select x.id from tablex x, tabley y where (x.id=y.testid and
>> y.typeid=7),.....
>>
>>
>>
>> There are more filter queries ahead.
>>
>>
>>
>> Waiting for your reply.
>>
>>
>>
>>
>>
>> Thanks & Regards,
>>
>> Trupti Ghuge
>>
>>
>>
>>
>>
>>
>> ============================================================================================================================Disclaimer:
>>  This message and the information contained herein is proprietary and
>> confidential and subject to the Tech Mahindra policy statement, you may
>> review the policy at <a href="http://www.techmahindra.com/Disclaimer.html
>> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="
>> http://tim.techmahindra.com/tim/disclaimer.html">
>> http://tim.techmahindra.com/tim/disclaimer.html</a> internally within
>> Tech
>> Mahindra.============================================================================================================================
>>



-- 
Met vriendelijke groet,

Martijn van Groningen

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Lucene join

Posted by Stephen Howe <si...@gmail.com>.
Trupti,

Looking over your sample query, that looks like you're trying to do a SQL
query against a database instead of a Lucene query. If you're going against
a SQL database, Lucene isn't a good tool for the problem you've outlined.
If you're using SQL, you can do multiple joins to link multiple tables
together. For instance, SELECT * FROM foo INNER JOIN bar ON foo.pid =
bar.idINNER JOIN foobar ON bar.oid = foobar.uid WHERE
foo.name != 'name'; lets you perform an inner join across three distinct
tables.

If you have a collection of text documents, for instance sales reports, and
want to find all the unstructured text documents mentioning the words
"BigClient", then Lucene offers a good solution to the problem. You could
create a simple term query that finds only those documents in the index
with the term "BigClient". The query would look like this (+BigClient) when
you ran the toString method after building the query.

If you're using a SQL database, Lucene isn't a good solution to the problem
you specified.

Hope it helps!
Stephen

On Mon, Aug 27, 2012 at 6:01 AM, Trupti Ghuge <tr...@techmahindra.com>wrote:

> Hi,
>
>
>
> I am new to Lucene. I have a complex query where I need to join more
> than two tables and have different filtering criteria on it.
>
> Is it possible to use Lucene for this ?
>
>
>
> For example , my query is as follows(there is no foreing key relation on
> the tables):
>
>
>
> Select x.id from tablex x, tabley y where (x.id=y.testid and
> y.typeid=7),.....
>
>
>
> There are more filter queries ahead.
>
>
>
> Waiting for your reply.
>
>
>
>
>
> Thanks & Regards,
>
> Trupti Ghuge
>
>
>
>
>
>
> ============================================================================================================================Disclaimer:
>  This message and the information contained herein is proprietary and
> confidential and subject to the Tech Mahindra policy statement, you may
> review the policy at <a href="http://www.techmahindra.com/Disclaimer.html
> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="
> http://tim.techmahindra.com/tim/disclaimer.html">
> http://tim.techmahindra.com/tim/disclaimer.html</a> internally within
> Tech
> Mahindra.============================================================================================================================
>