Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search results / Configure related records type depending on template. #7376

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented Oct 2, 2023

The search API provides the possibility to load related records for each hits. This allows to easily display them in search results but it also slow down a bit the search.

Currently only the list.html template was displaying them based on the following configuration:

resultViewTpls: ...
grid: {
  related: ["parent", "children", "services", "datasets"]
},

image

but user may want to customize this depending on the result template.

This move the configuration to the resultViewTpls (and preserve previous mechanism)

resultViewTpls: ...
              {
                tplUrl:
                  "../../catalog/components/" +
                  "search/resultsview/partials/viewtemplates/list.html",
                tooltip: "List",
                icon: "fa-bars",
                related: ["parent", "children", "services", "datasets"]
              },

so that user can more easily define which relations to load during search depending on the result template used.

Optimize search to avoid loading field not rendered in a template (eg. table mode don't display abstract and contacts)

image

              {
                tplUrl:
                  "../../catalog/components/" +
                  "search/resultsview/partials/viewtemplates/table.html",
                tooltip: "Table",
                icon: "fa-table",
                source: {
                  exclude: ["resourceAbstract*", "Org*", "contact*"]
                }

@fxprunayre fxprunayre added this to the 4.4.1 milestone Oct 2, 2023
@fxprunayre fxprunayre force-pushed the 4-searchresults-relatedconfig-cleanup branch from 737688b to de36d86 Compare October 2, 2023 13:08
The search API provides the possibility to load related records
for each hits. This allows to easily display them in search results
but it also slow down a bit the search.

Currently only the `list.html` template was displaying them based
on the following configuration:

```
resultViewTpls: ...
grid: {
  related: ["parent", "children", "services", "datasets"]
},
```

but user may want to customize this depending on the result template.

This move the configuration to the `resultViewTpls` (and preserve
previous mechanism)

```
resultViewTpls: ...
              {
                tplUrl:
                  "../../catalog/components/" +
                  "search/resultsview/partials/viewtemplates/list.html",
                tooltip: "List",
                icon: "fa-bars",
                related: ["parent", "children", "services", "datasets"]
              },
```

so that user can more easily define which relations to load during
search depending on the result template used.
@fxprunayre fxprunayre force-pushed the 4-searchresults-relatedconfig-cleanup branch from de36d86 to 9aaae5f Compare October 2, 2023 13:38
Each search results templates display a specific set of fields.
Add possibility to exclude unused fields from search to speed up search.

At some point, it could be better to declare all required fields for
rendering records on a per template basis on top of required fields
needed for the JS app logic (eg. privileges, status, draft).
@sonarcloud
Copy link

sonarcloud bot commented Oct 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

warning The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@fxprunayre fxprunayre modified the milestones: 4.4.1, 4.4.2 Nov 22, 2023
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look fine, tested and works.

But I can't find how to configure he new related configuration per search template results. If not present, I think should be included.

@fxprunayre
Copy link
Member Author

But I can't find how to configure he new related configuration per search template results. If not present, I think should be included.

Added @josegar74

image

Also updated missing translations.

@josegar74
Copy link
Member

@fxprunayre something not critical, but defining a for a template an array of related types to load and later emptying the section, doesn't save the change. You need to set value to []. Maybe the initial values can be set to [] so it's more clear?

@fxprunayre
Copy link
Member Author

@fxprunayre something not critical, but defining a for a template an array of related types to load and later emptying the section, doesn't save the change. You need to set value to []. Maybe the initial values can be set to [] so it's more clear?

Added default empty array [] in config.

Copy link

sonarcloud bot commented Jan 2, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@fxprunayre fxprunayre merged commit dc5df0c into main Jan 5, 2024
9 checks passed
@fxprunayre fxprunayre deleted the 4-searchresults-relatedconfig-cleanup branch January 5, 2024 11:57
josegar74 pushed a commit that referenced this pull request Feb 1, 2024
…plate. (#7376)

* Search results / Configure related records type depending on template.

The search API provides the possibility to load related records
for each hits. This allows to easily display them in search results
but it also slow down a bit the search.

Currently only the `list.html` template was displaying them based
on the following configuration:

```
resultViewTpls: ...
grid: {
  related: ["parent", "children", "services", "datasets"]
},
```

but user may want to customize this depending on the result template.

This move the configuration to the `resultViewTpls` (and preserve
previous mechanism)

```
resultViewTpls: ...
              {
                tplUrl:
                  "../../catalog/components/" +
                  "search/resultsview/partials/viewtemplates/list.html",
                tooltip: "List",
                icon: "fa-bars",
                related: ["parent", "children", "services", "datasets"]
              },
```

so that user can more easily define which relations to load during
search depending on the result template used.

* Search / Optimize field based on current template

Each search results templates display a specific set of fields.
Add possibility to exclude unused fields from search to speed up search.

At some point, it could be better to declare all required fields for
rendering records on a per template basis on top of required fields
needed for the JS app logic (eg. privileges, status, draft).

* Batch edit / Properly init result template config.

* Search / Optimize field based on current template / Add admin UI config.
josegar74 added a commit to osgeonl/geonetwork-dutch-skin that referenced this pull request Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants