dataverse icon indicating copy to clipboard operation
dataverse copied to clipboard

Iqss/7349 1 truncate description

Open qqmyers opened this issue 2 years ago • 1 comments

What this PR does / why we need it: Per issue #7349, Google rejects descriptions in the schema.org page metadata. Further, it expects description to be a string rather than a JsonArray which we were sending. This PR joins descriptions with a linefeed and then truncates the result to <5000 characters, sending the description up to the last word boundary before 4997 characters and appending a '...' to indicate there's more content.

Which issue(s) this PR closes:

Closes #7349

Special notes for your reviewer: This is one of ~3 PRs to close the issue

Suggestions on how to test this: Just verify the unit tests run. Can confirm manually by adding a long description and verifying it is truncated as described above (and that shorter ones aren't, and that two descriptions that total more than 5K chars are truncated together, etc.). That said, the unit tests do verify that two descriptions are joined, and there's a separate test for truncation.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: included

Additional documentation:

qqmyers avatar Oct 19 '22 15:10 qqmyers

Coverage Status

Coverage: 19.999% (-0.001%) from 20.0% when pulling 6a8ca451fb20d01354ecdc37b637a585a23c74db on QualitativeDataRepository:IQSS/7349-1_truncate_description into ecc23c0ebf2dc225a52804fec0188738a7873e5a on IQSS:develop.

coveralls avatar Oct 19 '22 15:10 coveralls

Prio meeting with Stefano.

  • Moved from External Commitments Backlog to ordered backlog

mreekie avatar Jan 10 '23 22:01 mreekie

Screen Shot 2023-01-30 at 3 10 49 PM Got an error when publishing 6k in 6, 1k descript: [descripTruncErr.txt](https://github.com/IQSS/dataverse/files/10539523/descripTruncErr.txt)

Dataset did publish but schema.org export was blank.

When tried 1, 6k description, it worked in the UI but schema.org export still blank and a single warning was posted to server.log: [2023-01-30T20:15:39.494+0000] [Payara 5.2022.3] [WARNING] [] [edu.harvard.iq.dataverse.engine.command.impl.FinalizeDatasetPublicationCommand] [tid: _ThreadID=251 _ThreadName=__ejb-thread-pool10] [timeMillis: 1675109739494] [levelValue: 900] [[ Finalization: exception caught while exporting: Unknown runtime exception exporting metadata. begin 0, end -1, length 6000]]

kcondon avatar Jan 30 '23 20:01 kcondon