What we need: We want all documents that have institutions in a specific range of latitude and longitude, and for these documents we want to return all the children of the document.
one document is like below:
{
"optionId":568510,
"id":"Major-568510-5",
"optionName":"Major A",
"category":"Major",
"_version_":1802116777088385024,
"institutions":[
{
"stateProvId":47,
"institutionSpatialField":37.123,-81.213
"institutionName":"University A",
"id":"MajorInstitution-568510-406-4",
"_nest_path_":"/institutions",
"category":"MajorInstitution",
"_version_":1802116777088385024,
"degrees":[
{
"degreeTypeId":3,
"id":"MajorInstitutionDegree-568510-406-20-3-5",
"_nest_path_":"/institutions/degrees",
"category":"MajorInstitutionDegree",
"_version_":1802116777088385024}]}
{
"stateProvId":14,
"institutionName":"University B",
"institutionSpatialField":38.123,-80.213
"id":"MajorInstitution-568510-408-4",
"_nest_path_":"/institutions",
"category":"MajorInstitution",
"_version_":1802116777088385024,
"degrees":[
{
"degreeTypeId":2,
"id":"MajorInstitutionDegree-568510-408-19-2-5",
"_nest_path_":"/institutions/degrees",
"category":"MajorInstitutionDegree",
"_version_":1802116777088385024}]}
}
Each document is a Major. Each Major has a list of institutions and each institution has a list of degrees.
We are using Solr version 8.1.
What we have tried:
We’ve tried using childFilter like below:
q=*:*&fq=category:(Major)&fl=*, [child childFilter="institutions/institutionSpatialField:[37.1,80 TO 38.1,82.13]"]]
Basically, adding a childFilter that filters for the range of lat,long that is searched for.
The issue with this is that the results stop at the institution level. Like below:
{
"id":"Major-568510-5",
"optionName":"Major A",
"category":"Major",
"_version_":1802116777088385024
"institutions":[
{
"stateProvId":47,
"institutionName":"University A",
"institutionSpatialField":37.123,-81.213,
"id":"MajorInstitution-568510-406-4",
"_nest_path_":"/institutions",
"_version_":1802116777088385024},
}
But, we want to also get the degrees for the filtered document.