On 25 October 2012 23:48, v vijith <vvij...@gmail.com> wrote: > Dear All, > > Apologize for lengthy email .... > > SOLR Version: 4 > > Im a newbie to SOLR and have gone through tutorial but could not get a > solution. The below requirement doesnt seem to be impossible but I > think Im missing the obvious. > > In my RDBMS, there is a Qualification table and an Employee table. An > employee can have many qualifications. The qualification can have > following attributes - GradeName and Grade. The search using sql query > to achieve my requirement is as below > > select * from qualification a, employee b where a.empid= b.empid and > a.gradename='MBA' and b.grade='A'; > > This will return me the employee along with the dept who has the grade > as MBA and has grade of A. > > Employee: 2 records > ------------------------- > Empid: 1 > Name: John > Location: California > > Qualifications: > Gradeid: 1 > Empid: 1 > Name: MBA > Grade: B > > Gradeid: 2 > Empid: 1 > Name: LEAD > Grade: A > -------------------- > > Empid: 2 > Name: George > Location: Nevada > > Qualifications: > Gradeid: 3 > Empid: 2 > Name: MBA > Grade: A > > Gradeid: 4 > Empid: 2 > Name: Graduate > Grade: C
Stop thinking of Solr in terms of RDBMS. Instead, flatten out your data. Thus, in your example, you could have a schema with the following fields: doc_id name location qualification grade doc_id is a unique identifier for Solr. If you want to retain Empid and Gradeid you could also add these. and the following entries 1 John California MBA B 2 John California Lead A 3 George Nevada MBA A 4 George Nevada Graduate C Searching for qualification:MBA and grade:A will then give you only record 3. Regards, Gora