I have a two or more collection in mongodb that are replicated to solr indexes using mongo-solr connectors. For the sake of explaining my problem I am facing lets take the traditional example of employee & department example (I know it's Document oriented DB & I can embed department to employee document, but please allow me to explain my question with this trivial example):
Employee document:
{
"_id": ObjectId(..),
"firstName": "John",
"lastName": "David",
"departMent": ObjectId(..) - a DBRef for department document
}
Department document:
{
"_id": ObjectId(..),
"departmentName": "Marketing"
}
Let's say that above two documents are linked in employee document using the department's object id ref. Now mongo-solr connector replicated these structures as it is and let's assume all of the fields are indexed and stored.
Now here is my question ( & the problem):
If I search the solr index by employee firstName (or lastName), I should get back results in such a way that the solr search response should include the "departmentName" instead of the Department ObjectId reference and that this should happen over a single search request originating from a client.
How do I do this using Solr apis?
Thanks in advance.