- Reconstitute facets config (IReconstituteConfigService JSON => FacetsConfig).
- Load facet content (IFacetLoadService: FacetsConfig => FacetContent)
- Remove bogus picks (BogusPickService: FacetsConfig => FacetsConfig)
- 📍Locate load content service (TargetFacet.FacetType => IFacetContentService)
- Load facet content (IFacetContentService: FacetsConfig => Core.FacetContent)
- Compile interval query
- Discrete facet:
- querySetup = QuerySetupBuilder.Build(facetsConfig, facetsConfig.TargetFacet, null, null);
- Interval query = IDiscreteContentSqlCompiler.Compile(querySetup, facetsConfig.TargetFacet, facetsConfig.GetTargetTextFilter())
SELECT cast({facet.CategoryIdExpr} AS varchar) AS category, {facet.CategoryNameExpr} AS name FROM {query.Facet.TargetTable.ResolvedSqlJoinName} {query.Joins.Combine("")} WHERE 1 = 1 {"AND ".GlueTo(CategoryNameLike(facet, categoryNameFilter)) } {"AND ".GlueTo(query.Criterias.Combine(" AND "))}" GROUP BY 1, 2 {SortBy(facet)}";
- Range facet:
SELECT n::text || ' => ' || (n + {interval})::text, n, n + {interval} FROM generate_series({min}, {max}, {interval}) as a(n) WHERE n < {max}
- Discrete facet:
- Fetch category counts
- Fetch outer category counts
- Collect user selections/picks
- Compile facet content result
- Compile interval query
FIXME: IIntervalSqlCompiler saknas (olika interface) 📍logic split based on facet type
Category counts: results of compiled interval query Outer category counts: results of compiled interval query (no grouping or additional fields)
| Concept | Description |
|---|---|
| Filter facet | A filter specification. |
| Target facet | A requests main target facet |
| Aggregate facet | |
| View type | |
| Result specification | A specification of result fields. |
| Item(s) | Description | Default | Impacts | Entity |
|---|---|---|---|---|
| Result facet code | Specifies aggregate facet | result_facet |
facet | |
| Result view type | Specifies if result is tabular or map | map or tabular |
result_view_type | |
| Specification keys | A specification of result fields. | (null) | result_specification |
Notes:
- Fi
- The request specifies the result facet (most often
result_facet). 1. - The request contains a
view type(e.g.maportabular) specifying the format of the resulting data.- The
view typespecifies if the client wabt
- The
- The request also contains an optional set of specification keys 1.
- [domain-facet://]target-facet[@trigger-facet]:(facet-code[@picks])(/facet-code[@picks])*
Trigger: country add
{
"requestId": 1,
"requestType": "populate",
"targetCode": "country",
"domainCode": "",
"facetConfigs": [
{ "facetCode": "country", "position": 1, "picks": [] }
]
}Trigger: country pick value
{
"facetsConfig": {
"requestId": 10,
"requestType": "populate",
"domainCode": "",
"targetCode": "country",
"triggerCode": "country",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [{ "pickValue": 205, "text": 205 }]
}
]
},
"resultConfig": {
"requestId": 10,
"sessionId": "1",
"viewTypeId": "map",
"aggregateKeys": ["site_level"]
}
}Trigger: site add
{
"requestId": 1,
"requestType": "populate",
"targetCode": "sites",
"triggerCode": "country",
"domainCode": "",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [{ "pickValue": 205, "text": 205 }],
},
{ "facetCode": "sites", "position": 2, "picks": [] }
]
}Trigger: site pick value
{
"facetsConfig": {
"requestId": 11,
"requestType": "populate",
"domainCode": "",
"targetCode": "sites",
"triggerCode": "sites",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [{ "pickValue": 205, "text": 205 }],
},
{
"facetCode": "sites",
"position": 2,
"picks": [{ "pickValue": 3826, "text": 3826 }],
}
]
},
"resultConfig": {
"requestId": 11,
"sessionId": "1",
"viewTypeId": "map",
"aggregateKeys": ["site_level"]
}
}Trigger (chain): country pick value 224
Facet load [sites]
Should triggerCode actually be country in this case??? TODO: Check usage of triggerCode
{
"requestId": 2,
"requestType": "populate",
"targetCode": "sites",
"triggerCode": "sites",
"domainCode": "",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "sites",
"position": 2,
"picks": [{ "pickValue": 3826, "text": 3826 }]
}
]
}Result load
{
"facetsConfig": {
"requestId": 12,
"requestType": "populate",
"domainCode": "",
"targetCode": "sites",
"triggerCode": "sites",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "sites",
"position": 2,
"picks": [{ "pickValue": 3826, "text": 3826 }]
}
]
},
"resultConfig": {
"requestId": 12,
"sessionId": "1",
"viewTypeId": "map",
"aggregateKeys": ["site_level"]
}
}Trigger: site@pick 3830
Facet load [sites]
{
"facetsConfig": {
"requestId": 13,
"requestType": "populate",
"domainCode": "",
"targetCode": "sites",
"triggerCode": "sites",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "sites",
"position": 2,
"picks": [
{ "pickValue": 3826, "text": 3826 },
{ "pickValue": 3830, "text": 3830 }
]
}
]
},
"resultConfig": {
"requestId": 13,
"sessionId": "1",
"viewTypeId": "map",
"aggregateKeys": ["site_level"]
}
}Trigger: country@pick 224
Facet load #1 [sites]
{
"requestId": 8,
"requestType": "populate",
"targetCode": "sites",
"triggerCode": "genus",
"domainCode": "",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "genus",
"position": 2,
"picks": [
{ "pickValue": 12974, "text": 12974 },
{ "pickValue": 12793, "text": 12793 },
{ "pickValue": 12932, "text": 12932 }
]
},
{ "facetCode": "sites", "position": 3, "picks": [] }
]
}Facet load #2 [genus]
{
"requestId": 4,
"requestType": "populate",
"targetCode": "genus",
"triggerCode": "genus",
"domainCode": "",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "genus",
"position": 2,
"picks": [
{ "pickValue": 12974, "text": 12974 },
{ "pickValue": 12793, "text": 12793 },
{ "pickValue": 12932, "text": 12932 }
]
},
{ "facetCode": "sites", "position": 3, "picks": [] }
]
}Result load
{
"facetsConfig": {
"requestId": 23,
"requestType": "populate",
"domainCode": "",
"targetCode": "sites",
"triggerCode": "sites",
"facetConfigs": [
{
"facetCode": "country",
"position": 1,
"picks": [
{ "pickValue": 205, "text": 205 },
{ "pickValue": 224, "text": 224 }
]
},
{
"facetCode": "genus",
"position": 2,
"picks": [
{ "pickValue": 12974, "text": 12974 },
{ "pickValue": 12793, "text": 12793 },
{ "pickValue": 12932, "text": 12932 }
]
},
{ "facetCode": "sites", "position": 3, "picks": [] }
]
},
"resultConfig": {
"requestId": 23,
"sessionId": "1",
"viewTypeId": "map",
"aggregateKeys": ["site_level"]
}
}Trigger: site