You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Nancy Goyal <87...@gmail.com> on 2018/05/29 07:50:14 UTC
Understanding SOLR Joins
Hi,
I have implemented basic SOLR Joins between two collections. Currently in
my project implementation, we are getting data from multiple tables and
storing as single document in view and indexing that view. We got a
suggestion to implement the same with Joins but not sure if the same
functionalities can be achieved with JOINs or Block Join (Nested documents)-
*Data*
There are multiple tables, one primary table having all the basic details
about product, the primary key is Product ID and then 7-8 other tables
having other details of product, it has Product ID column too but can have
multiple entries for single Product ID.
*Can you please let me know if the below are possible-*
1. Can we get data from multiple collections in the search results. The
results should contain only one record for a single product ID?
2. Can we search across multiple collections in a single query and then
club the results, so that final search results will have single result for
each Product ID.
3. Can we perform join on more than 2 collections as we need to search
across 6-7 collections and then merge the data based on product ID.
4. Can we query Parent and child in nested index at the same time.
Example- perform search on column1 from Parent and Column2 from Child and
get the parent records with nested child in search results?
5. If we can perform fielded search across multiple collections in the
single query,will the filters from different collections be returned in a
single search response
The examples i got from internet have joins only between two collections
and searching only on single collection.
Thanks & Regards,
Nancy Goyal
Re: Understanding SOLR Joins
Posted by Mikhail Khludnev <mk...@apache.org>.
On Tue, May 29, 2018 at 10:50 AM, Nancy Goyal <87...@gmail.com> wrote:
> Hi,
>
>
> I have implemented basic SOLR Joins between two collections. Currently in
> my project implementation, we are getting data from multiple tables and
> storing as single document in view and indexing that view. We got a
> suggestion to implement the same with Joins but not sure if the same
> functionalities can be achieved with JOINs or Block Join (Nested
> documents)-
>
> *Data*
>
> There are multiple tables, one primary table having all the basic details
> about product, the primary key is Product ID and then 7-8 other tables
> having other details of product, it has Product ID column too but can have
> multiple entries for single Product ID.
>
> *Can you please let me know if the below are possible-*
>
> 1. Can we get data from multiple collections in the search results. The
> results should contain only one record for a single product ID?
>
You can collection=depts,emps param to search across few collections
(although it wasn't documented)
Default merge behavior is to collapse recs with the same id to one, missing
duplicated ids.
> 2. Can we search across multiple collections in a single query and then
> club the results, so that final search results will have single result
> for
> each Product ID.
>
It sounds like grouping functionality, but I'm not sure it can do that with
a few collections. Probably [subquery] is an option.
> 3. Can we perform join on more than 2 collections as we need to search
> across 6-7 collections and then merge the data based on product ID.
>
For such advanced cases you may try to use Streaming Expressions, it can
search and merge, but I've never do anything like this.
> 4. Can we query Parent and child in nested index at the same time.
> Example- perform search on column1 from Parent and Column2 from Child
> and
> get the parent records with nested child in search results?
>
[subquery], [child] result transformers
> 5. If we can perform fielded search across multiple collections in the
> single query,will the filters from different collections be returned in
> a
> single search response
>
This may probably done with [subquery].
>
> The examples i got from internet have joins only between two collections
> and searching only on single collection.
>
> Thanks & Regards,
> Nancy Goyal
>
--
Sincerely yours
Mikhail Khludnev