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

[ACS-6427] Add search highlighting #3637

Merged
merged 6 commits into from
Feb 15, 2024
Merged

Conversation

MichalKinas
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)

Nothing is highlighted in search results.

What is the new behaviour?

Search phrase is highlighted in node name, title, description and content. Description is now part of name column. Highlighting config is added to each existing filters sets. https://alfresco.atlassian.net/browse/ACS-6427
Zrzut ekranu 2024-02-12 o 08 21 56

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

const { name, properties } = this.node.entry;
const title = properties ? properties['cm:title'] : '';

const highlights: SearchEntryHighlight[] = this.node.entry['search']?.['highlight'];
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be good idea to update model to have search and highlight fields defined inside models? Thanks that we won't need to do some workarounds with [] and IDE will hint available fields.

Not sure if that is easy to update and if that is possible so if not in that PR we can also raise task for that. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically ResultSetRowEntry contains search properties but the component itself needs regular node to pass it to subsequent methods accepting node only, and node itself shouldn't contain the search properties imo @DenysVuika what do you think?

@@ -46,6 +46,8 @@ import { MatDialogModule } from '@angular/material/dialog';
host: { class: 'aca-search-results-row' }
})
export class SearchResultsRowComponent implements OnInit, OnDestroy {
private readonly highlightPrefix = "<span class='aca-highlight'>";
Copy link
Contributor

Choose a reason for hiding this comment

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

should not we get this from the config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could but then the question comes which filter set we should base on, also there might be new ones added by the customers so this wouldn't be very reliable solution as well

@MichalKinas MichalKinas force-pushed the dev-acs-6427-search-highlights branch from 8f2510e to 4b22e05 Compare February 15, 2024 09:40
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@MichalKinas MichalKinas merged commit 4766bfe into develop Feb 15, 2024
27 checks passed
@MichalKinas MichalKinas deleted the dev-acs-6427-search-highlights branch February 15, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants