Duplicated search results in document viewer

Which product are you using?

PDF.js Express Version 8.7.0

Detailed description of issue
When there are a lot of search results, some of them are duplicated. It is not a consistent behaviour for the same document and search string sometimes there are no duplicates, and the other times the different results are duplicated. Sometimes when I click on the duplicated search result, the original one is highlighted, sometimes not. I can provide the video of this behaviour, but I’m not sure how to upload it. On the screenshot the two search results at the beginning and end of page 4 are duplicates.

Expected behaviour
All the search occurances are displayed once in the search panel.

Does your issue happen with every document, or just one?
It happens on different documents. Looks like the prerequisite is lots of search results.

Link to document

Code snippet

documentViewer.addEventListener('documentLoaded', () => {
    instance.searchTextFull(searchQuery, { regex: true });

Hi there,

Thank you for contacting pdf.js express forums,

I was unable to reproduce this issue on our showcase: PDF.js Viewer Demo | PDF.js Express

Could you please try version 8.7.2 and see if your issue is reproducible?

Or if you’re using the viewer version:

Best regards,
Kevin Kim

The version I’m using is the following:

  1. Build: “My8yOS8yMDIzfDRjYmI5MWQ4OGI=”
  2. Core version: “8.7.2”
  3. Full API: false
  4. UI version: “8.7.0”
  5. WebViewer Server: false
  6. webviewer.min.js: “8.7.2”
    The bug is reproducible on different documents

Hi there,

Using the same version you provided, I was unable to reproduce the issue (41 results):

Could you please share your full WebViewer code or a minimal sample project for us to reproduce this issue?

Best regards,
Kevin Kim