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

feat(web): List search - make content searchable #16701

Merged
merged 6 commits into from
Nov 4, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Nov 1, 2024

List search - make content searchable

What

  • Generic List - content field is now searchable
  • Team List - intro field is now searchable

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced content extraction for list items and team members, now incorporating detailed introductions instead of just names.
    • Improved handling of cardIntro and content fields for better text representation.
  • Bug Fixes

    • Maintained error handling during mapping processes, ensuring warnings are logged for any issues encountered.

@RunarVestmann RunarVestmann added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Nov 1, 2024
@RunarVestmann RunarVestmann requested review from a team as code owners November 1, 2024 16:14
Copy link
Contributor

coderabbitai bot commented Nov 1, 2024

Walkthrough

The pull request introduces modifications to the GenericListItemSyncService and TeamListSyncService classes in their respective service files. Key changes include the addition of a new import for documentToPlainTextString and significant updates to the doMapping method in both services. The handling of the cardIntro field in GenericListItemSyncService and the intro field in TeamListSyncService has been enhanced to improve content extraction and processing, while maintaining existing error handling mechanisms.

Changes

File Path Change Summary
libs/cms/src/lib/search/importers/genericListItem.service.ts - Added import for documentToPlainTextString.
- Modified doMapping method to enhance processing of cardIntro and content.
libs/cms/src/lib/search/importers/teamList.service.ts - Added import for documentToPlainTextString.
- Updated doMapping method to extract intro from memberEntry instead of member.name.

Possibly related PRs

  • feat(web): Clickable generic list items #15003: The changes in GenericListItemSyncService and TeamListSyncService both involve modifications to the handling of list items, specifically in how content is processed and displayed, indicating a shared focus on enhancing list item functionality.
  • feat(web): Tag filtering for generic lists #15196: This PR also modifies the GenericListItemSyncService, introducing tag filtering functionality that aligns with the changes made to the doMapping method in the main PR, which enhances how content is processed.
  • feat(web): Team List - Move frontend logic to the backend #15965: The changes in TeamListSyncService regarding the processing of team members and their tags relate to the modifications in GenericListItemSyncService, as both services are involved in handling list items and their associated data.
  • feat(web): Generic list - External url field #16348: The addition of external URL handling in the GenericListItem model and the GenericList component connects with the changes made in the main PR, which also focuses on enhancing the processing of list item content.

Suggested reviewers

  • mannipje

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
libs/cms/src/lib/search/importers/genericListItem.service.ts (1)

46-50: Consider improving maintainability with constants and documentation

The magic numbers in extractStringsFromObject could be more maintainable as named constants.

Apply this improvement:

+ // Maximum depth and length limits for content extraction
+ const MAX_CONTENT_LENGTH = 100;
+ const MAX_RECURSION_DEPTH = 2;

  extractStringsFromObject(
    mapped.content.map(pruneNonSearchableSliceUnionFields),
-   100,
-   2,
+   MAX_CONTENT_LENGTH,
+   MAX_RECURSION_DEPTH,
  ),

Also, consider adding JSDoc comments to explain the content processing logic for future maintainers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6450d16 and f0ff13b.

📒 Files selected for processing (2)
  • libs/cms/src/lib/search/importers/genericListItem.service.ts (2 hunks)
  • libs/cms/src/lib/search/importers/teamList.service.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/cms/src/lib/search/importers/genericListItem.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/cms/src/lib/search/importers/teamList.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (3)
libs/cms/src/lib/search/importers/teamList.service.ts (1)

4-4: LGTM: Appropriate rich text renderer import added

The addition of documentToPlainTextString is appropriate for converting Contentful rich text to searchable plain text.

libs/cms/src/lib/search/importers/genericListItem.service.ts (2)

5-5: LGTM: Appropriate use of Contentful's plain text renderer

The addition of documentToPlainTextString is well-suited for converting rich text content to searchable plain text.


37-54: LGTM: Well-structured content processing implementation

The new content processing logic effectively combines rich text and structured content for search indexing while maintaining clean separation of concerns.

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 15.38462% with 11 lines in your changes missing coverage. Please review.

Project coverage is 36.56%. Comparing base (b40fc3f) to head (aaa1a11).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...rc/lib/search/importers/genericListItem.service.ts 14.28% 6 Missing ⚠️
...s/cms/src/lib/search/importers/teamList.service.ts 16.66% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16701      +/-   ##
==========================================
- Coverage   36.63%   36.56%   -0.07%     
==========================================
  Files        6873     6881       +8     
  Lines      143120   143380     +260     
  Branches    40796    40871      +75     
==========================================
+ Hits        52426    52429       +3     
- Misses      90694    90951     +257     
Flag Coverage Δ
air-discount-scheme-backend 54.03% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.96% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.82% <15.38%> (-0.03%) ⬇️
api-domains-criminal-record 47.40% <ø> (ø)
api-domains-driving-license 44.44% <ø> (ø)
api-domains-education 31.20% <ø> (ø)
api-domains-health-insurance 34.23% <ø> (ø)
api-domains-mortgage-certificate 34.63% <ø> (ø)
api-domains-payment-schedule 41.19% <ø> (ø)
application-api-files 56.49% <ø> (ø)
application-core 71.93% <ø> (ø)
application-system-api 41.29% <15.38%> (-0.01%) ⬇️
application-templates-accident-notification 29.21% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.26% <ø> (ø)
application-templates-driving-license 18.40% <ø> (ø)
application-templates-estate 12.18% <ø> (ø)
application-templates-example-payment 25.17% <ø> (ø)
application-templates-financial-aid 15.56% <ø> (ø)
application-templates-general-petition 23.40% <ø> (ø)
application-templates-inheritance-report 6.52% <ø> (ø)
application-templates-marriage-conditions 15.20% <ø> (ø)
application-templates-mortgage-certificate 43.52% <ø> (ø)
application-templates-parental-leave 29.93% <ø> (ø)
application-types 6.62% <ø> (ø)
application-ui-components 1.27% <ø> (ø)
application-ui-shell 20.86% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.12% <ø> (ø)
clients-driving-license-book 43.38% <ø> (ø)
clients-financial-statements-inao 48.91% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.18% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.15% <ø> (ø)
cms 0.42% <0.00%> (-0.01%) ⬇️
cms-translations 38.95% <15.38%> (-0.03%) ⬇️
contentful-apps 4.69% <ø> (-0.51%) ⬇️
dokobit-signing 62.40% <ø> (ø)
download-service 44.23% <ø> (ø)
email-service 60.24% <ø> (ø)
feature-flags 90.32% <ø> (ø)
file-storage 52.41% <ø> (ø)
financial-aid-backend 51.24% <ø> (ø)
judicial-system-api 19.57% <ø> (ø)
judicial-system-audit-trail 68.53% <ø> (ø)
judicial-system-backend 55.24% <15.38%> (-0.03%) ⬇️
judicial-system-message 66.66% <ø> (ø)
judicial-system-message-handler 47.53% <ø> (ø)
judicial-system-scheduler 70.35% <ø> (ø)
license-api 42.61% <ø> (+0.07%) ⬆️
nest-config 77.74% <ø> (ø)
nest-feature-flags 50.19% <ø> (-0.65%) ⬇️
nova-sms 61.71% <ø> (ø)
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 15.96% <ø> (ø)
services-auth-admin-api 51.87% <ø> (ø)
services-auth-delegation-api 57.45% <ø> (-0.07%) ⬇️
services-auth-ids-api 51.45% <ø> (+<0.01%) ⬆️
services-auth-personal-representative 45.08% <ø> (ø)
services-auth-personal-representative-public 41.27% <ø> (ø)
services-auth-public-api 48.96% <ø> (ø)
services-endorsements-api 53.58% <ø> (ø)
services-sessions 65.36% <ø> (ø)
services-university-gateway 49.19% <ø> (-0.09%) ⬇️
services-user-notification 46.88% <15.38%> (-0.07%) ⬇️
services-user-profile 61.75% <ø> (-0.08%) ⬇️
web 1.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/cms/src/lib/search/importers/teamList.service.ts 17.14% <16.66%> (+0.47%) ⬆️
...rc/lib/search/importers/genericListItem.service.ts 16.21% <14.28%> (+0.08%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92e7cd7...aaa1a11. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 1, 2024

Datadog Report

All test runs 0c4fc43 🔗

70 Total Test Services: 0 Failed, 67 Passed
🔻 Test Sessions change in coverage: 5 decreased, 3 increased, 192 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 82 0 30.38s 1 no change Link
air-discount-scheme-web 0 0 0 2 0 7.75s 1 no change Link
api 0 0 0 4 0 2.77s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 18.74s N/A Link
api-domains-assets 0 0 0 3 0 11.93s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 14.04s 1 no change Link
api-domains-communications 0 0 0 5 0 31.79s 1 decreased (-0.03%) Link
api-domains-criminal-record 0 0 0 5 0 9.9s 1 no change Link
api-domains-driving-license 0 0 0 23 0 29.19s N/A Link
api-domains-education 0 0 0 8 0 19.45s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (5)

  • services-auth-delegation-api - jest 51.36% (-0.18%) - Details
  • api-domains-communications - jest 49% (-0.03%) - Details
  • cms-translations - jest 48.42% (-0.03%) - Details
  • services-user-notification - jest 69.57% (-0.02%) - Details
  • judicial-system-backend - jest 58.71% (-0.02%) - Details

@gudjong gudjong removed the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Nov 4, 2024
@RunarVestmann RunarVestmann added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants