View merge rules¶
When a search request contains a viewId, the Infocenter loads the view and uses it as the base configuration.
The properties of the request are then merged into the view. The general rule is:
- Filters of the view always apply. Filters of the request are added on top with a logical AND, so a request can only refine the result of the view, never expand it.
- Settings such as
orderBy,select,resultsPerPageorcurrentPagethat are set in the request replace the value of the view. - Facets are merged according to the rules below.
Facets merge rules¶
Both the view and the request can define facets. The following table shows which facets the response contains for
every combination. null means the property is not provided, empty means an empty list [], value means a list
with at least one facet.
| Facets in the view | Facets in the request | Facets in the response | Explanation |
|---|---|---|---|
| null | null | null | Neither side defines facets: the search API returns its default behavior. |
| null | empty | empty | The request explicitly asks for no facets. |
| empty | null | empty | The view explicitly defines no facets. A request without facets cannot be distinguished from a request that does not provide them, so the view wins. |
| null | value | value | Only the request defines facets: they are used as they are. |
| empty | value | value | The view defines no facets, the request does: the facets of the request are used. |
| value | null | value | Only the view defines facets: they are used as they are. This is the usual case for a website that uses a view. |
| value | empty | empty | The request explicitly asks for no facets and overrides the view. |
| value | value | intersection | Both define facets: only the facets whose name exists on both sides are returned, with the definition of the request. A request cannot add facets that the view does not define. |
Example
A view defines the facets categoryTree and containedInPlace/id. A website sends a search with the viewId
and the facets categoryTree and tag.
The response contains only categoryTree: it is the only facet that exists in both the view and the request. tag
is not part of the view and containedInPlace/id was not requested.
If the website sends the search with the viewId and no facets property, the response contains both facets
of the view, categoryTree and containedInPlace/id.
flowchart LR
subgraph V["View"]
direction TB
V1["categoryTree"]
V2["containedInPlace/id"]
end
subgraph R["Request with viewId"]
direction TB
R1["categoryTree"]
R2["tag"]
end
M{"Merge<br/>keep names on both sides"}
subgraph O["Response"]
O1["categoryTree"]
end
subgraph D["Not returned"]
direction TB
D2["containedInPlace/id<br/>not requested"]
D3["tag<br/>not defined in the view"]
end
V --> M
R --> M
M -->|"on both sides"| O
M -.->|"on one side only"| D
classDef cat fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332
classDef place fill:#ffe8cc,stroke:#d9480f,color:#862e0a
classDef tag fill:#dbe4ff,stroke:#3b5bdb,color:#1e3a8a
classDef kept fill:#b7e4c7,stroke:#1b4332,color:#1b4332,font-weight:bold,stroke-width:2px
class V1,R1 cat
class V2,D2 place
class R2,D3 tag
class O1 kept