As far as I can tell you should use multiValued for these fields:
<field name="education" type="textgen" indexed="true" stored="true"
multiValued="true"/>
<field name="employer" type="textgen" indexed="true" stored="true"
multiValued="true"/>
In order to get the data from the DB you should either create a sub
entity with its own query or (the better performance option) use
something like:
SELECT cp.name,
GROUP_CONCAT(ce.CandidateEducation SEPARATOR '|') AS
multiple_educations,
GROUP_CONCAT(e.Employer SEPARATOR '|') AS multiple_employers
FROM CandidateProfile_Table cp
LEFT JOIN CandidateEducation_Table ce ON cp.name = ce.name
LEFT JOIN Employers_Table e ON cp.name = e.name
GROUP BY cp.name
This creates one line with the educations and employers concatenated
into pipe (|) delimited fields. Then you'd have to break up the
multiple fields using a RegexTransformer - use something like:
<entity name="candidates"
query="...see above..."
transformer="RegexTransformer" >
<field name="education" column="multiple_educations"
splitBy="\|"/>
<field name="employer" column="multiple_employers"
splitBy="\|"/>
</entity>
The SQL probably doesn't fit your DB schema, but it's just to clarify
the idea. You might have to pick a different field separator if pipe
(|) might be in your data...
Ephraim Ofir
-----Original Message-----
From: Sumit Arora [mailto:[email protected]]
Sent: Thursday, August 26, 2010 1:36 PM
To: [email protected]
Subject: Candidate Profile Search which have multiple employers and
Educations.
I have to search candidate's profile , on which I have following Tables
:
Candidate Profile Record : CandidateProfile_Table
CandidateEducation : CandidateEducation_Table // EducationIn Different
Institutes or Colleges :
Employers : Employers_Table //More than One Employers :
If I denormalize this all three Table :
CandidateProfile_Table - 1 Row for Sumit
CandidateEducation_Table - 5 Rows for Sumit
Employers_Table - 5 Rows for Sumit
If these three tables will go to Index in Solr , It will create 25
Documents
for one row.
In this Case What Should be My Approach :
DeNormalize all three tables and while querying from Solr use Field
Collpase
parameter by CandidateProfile Id, So It will return one record.
Or
I should use CandidateEducation_Table,CandidateEducation_Table as
MultiValued in Solr ?
If that is the case, then How I can apply Solr way to use MultiValue
e.g;
I need to use Following Configuration in Scehma.xml :
<field name="education" type="textgen" indexed="true" stored="true"/>
<field name="employer" type="textgen" indexed="true" stored="true"/>
After this :
I should pick all education values(from MySql Education Database Table)
concerned to one profile
and keep this in a one variable - EducationValuesForSolr
and then EducationValuesForSolr's value need to assign to Schema.XML
defined
variable education ?
Please let me know If I am using right approach and Comments?
/Sumit