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 ashokcz <as...@tcs.com> on 2009/10/15 06:27:00 UTC
storing multiple type of records (Parent - Child Relationship)
Hi All ,
I have a specific requirement of storing multiple type of records. but dont
know how to do it .
First let me tell the requirement.
I have a table called user table and a user can be mapped to multiple
projects.
User table details are User Name , User Id , address , and other details .
I have stored them in solr but now the mapping between user and project has
to be stored .
Project table have (project name , location , business unit ,etc)
I can still go ahead and store user has single record with project details
as indvidual fields , like
UserId:user1
UserAddress: india
ProjectNames: project1,project2
ProjectBU: retail , finance
ProjectLocation:UK,US
Here i will search in fields like UserId , ProjectBU ,ProjectLocation and
have made UserAddress, ProjectLocation as facets
but is there a way where we can store user records separately and project
records separately .
and jut give the link in solr ?? like mentioned below and still making it
searchable and facetable ??
User Details
=========
UserId:user1
UserAddress: india
ProjectId:1,2
Project Details
==========
ProjectId:1
ProjectNames: project1
ProjectBU: retail
ProjectLocation:UK
ProjectId:2
ProjectNames: project2
ProjectBU:finance
ProjectLocation:US
--
View this message in context: http://www.nabble.com/storing-multiple-type-of-records-%28Parent---Child-Relationship%29-tp25902894p25902894.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: storing multiple type of records (Parent - Child Relationship)
Posted by ashokcz <as...@tcs.com>.
thanks Avlesh for your reply.
ya even i had that idea .....
but the problem is project data could change very rapdily.
so in that case i will end up changing the associated user details .
say i have just 100 Project records but 1,00,000 user records .
then changing one project record means changing associated all user records
.may be it will go to 1000's.
so any idea of how to do it ??
or any suggestions for that ??
Avlesh Singh wrote:
>
>>
>> but is there a way where we can store user records separately and project
>> records separately. and jut give the link in solr ?? like mentioned below
>> and still making it
>> searchable and facetable ??
>>
> With single core, unfortunately not.
>
> Denormalizing data for storage and searches is a regular practice in Solr.
> It might not sound "proper" if you try to do this with heavily normalized
> data but there nothing wrong about it.
>
> To be specific, in your case, the fields to facet and search upon are
> designed correctly. My understanding is that you need the relationships to
> be preserved only for display. Right? If yes, then you can always create
> an
> untokenized field, say string, and store all the project specific data in
> some delimited format. e.g. in your case -
> projectName$$projectBU$$projectLocation etc. This data can be interpreted
> in
> your application to convert it back into a proper relational data
> structure
> for each document in the result.
>
> Cheers
> Avlesh
>
> On Thu, Oct 15, 2009 at 9:57 AM, ashokcz <as...@tcs.com>
> wrote:
>
>>
>> Hi All ,
>> I have a specific requirement of storing multiple type of records. but
>> dont
>> know how to do it .
>> First let me tell the requirement.
>> I have a table called user table and a user can be mapped to multiple
>> projects.
>> User table details are User Name , User Id , address , and other details
>> .
>> I have stored them in solr but now the mapping between user and project
>> has
>> to be stored .
>> Project table have (project name , location , business unit ,etc)
>>
>> I can still go ahead and store user has single record with project
>> details
>> as indvidual fields , like
>> UserId:user1
>> UserAddress: india
>> ProjectNames: project1,project2
>> ProjectBU: retail , finance
>> ProjectLocation:UK,US
>>
>> Here i will search in fields like UserId , ProjectBU ,ProjectLocation and
>> have made UserAddress, ProjectLocation as facets
>>
>>
>> but is there a way where we can store user records separately and project
>> records separately .
>> and jut give the link in solr ?? like mentioned below and still making it
>> searchable and facetable ??
>>
>> User Details
>> =========
>> UserId:user1
>> UserAddress: india
>> ProjectId:1,2
>>
>> Project Details
>> ==========
>> ProjectId:1
>> ProjectNames: project1
>> ProjectBU: retail
>> ProjectLocation:UK
>>
>> ProjectId:2
>> ProjectNames: project2
>> ProjectBU:finance
>> ProjectLocation:US
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/storing-multiple-type-of-records-%28Parent---Child-Relationship%29-tp25902894p25902894.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/storing-multiple-type-of-records-%28Parent---Child-Relationship%29-tp25902894p25903679.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: storing multiple type of records (Parent - Child Relationship)
Posted by Avlesh Singh <av...@gmail.com>.
>
> but is there a way where we can store user records separately and project
> records separately. and jut give the link in solr ?? like mentioned below
> and still making it
> searchable and facetable ??
>
With single core, unfortunately not.
Denormalizing data for storage and searches is a regular practice in Solr.
It might not sound "proper" if you try to do this with heavily normalized
data but there nothing wrong about it.
To be specific, in your case, the fields to facet and search upon are
designed correctly. My understanding is that you need the relationships to
be preserved only for display. Right? If yes, then you can always create an
untokenized field, say string, and store all the project specific data in
some delimited format. e.g. in your case -
projectName$$projectBU$$projectLocation etc. This data can be interpreted in
your application to convert it back into a proper relational data structure
for each document in the result.
Cheers
Avlesh
On Thu, Oct 15, 2009 at 9:57 AM, ashokcz <as...@tcs.com> wrote:
>
> Hi All ,
> I have a specific requirement of storing multiple type of records. but dont
> know how to do it .
> First let me tell the requirement.
> I have a table called user table and a user can be mapped to multiple
> projects.
> User table details are User Name , User Id , address , and other details .
> I have stored them in solr but now the mapping between user and project has
> to be stored .
> Project table have (project name , location , business unit ,etc)
>
> I can still go ahead and store user has single record with project details
> as indvidual fields , like
> UserId:user1
> UserAddress: india
> ProjectNames: project1,project2
> ProjectBU: retail , finance
> ProjectLocation:UK,US
>
> Here i will search in fields like UserId , ProjectBU ,ProjectLocation and
> have made UserAddress, ProjectLocation as facets
>
>
> but is there a way where we can store user records separately and project
> records separately .
> and jut give the link in solr ?? like mentioned below and still making it
> searchable and facetable ??
>
> User Details
> =========
> UserId:user1
> UserAddress: india
> ProjectId:1,2
>
> Project Details
> ==========
> ProjectId:1
> ProjectNames: project1
> ProjectBU: retail
> ProjectLocation:UK
>
> ProjectId:2
> ProjectNames: project2
> ProjectBU:finance
> ProjectLocation:US
>
>
> --
> View this message in context:
> http://www.nabble.com/storing-multiple-type-of-records-%28Parent---Child-Relationship%29-tp25902894p25902894.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>