# Duplicated search results in document viewer

**URL:** <https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548>\
**Category:** Technical Support\
**Created:** [April 27, 2023, 10:39am UTC](https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548 "2023-04-27T10:39:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![polina.meleca](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@polina.meleca](https://pdfjs.community/u/polina.meleca)\
**Post date:** [April 27, 2023, 10:39am UTC](https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548/1 "2023-04-27T10:39:56Z")

</div>

**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.

 ![Screenshot 2023-04-27 at 12.40.41](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/0/0e01c64b02b1e30cfc30f30a34cf199d37887b27.jpeg)

**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**  
([https://assets.aboutamazon.com/49/3f/3b3323574db3af860813ff0a3066/amazon-community-impact-report-puget-sound.pdf](https://assets.aboutamazon.com/49/3f/3b3323574db3af860813ff0a3066/amazon-community-impact-report-puget-sound.pdf))

**Code snippet**

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

```

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [April 27, 2023, 5:05pm UTC](https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548/2 "2023-04-27T17:05:20Z")

</div>

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](https://pdfjs.express/demo)

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

> **[@pdftron/pdfjs-express](https://www.npmjs.com/package/@pdftron/pdfjs-express/v/8.7.2?activeTab=versions)**
>
> \[PDFJS Express\](https://pdfjs.express) is a powerful JavaScript-based PDF Library that wraps \[PDF.js\](https://mozilla.github.io/pdf.js/). It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and...

Or if you’re using the viewer version:

> **[@pdftron/pdfjs-express-viewer](https://www.npmjs.com/package/@pdftron/pdfjs-express-viewer?activeTab=versions)**
>
> \[PDFJS Express\](https://pdfjs.express) is a powerful JavaScript-based PDF Library that wraps \[PDF.js\](https://mozilla.github.io/pdf.js/). It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and...

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![polina.meleca](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@polina.meleca](https://pdfjs.community/u/polina.meleca)\
**Post date:** [May 2, 2023, 5:31pm UTC](https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548/3 "2023-05-02T17:31:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [May 2, 2023, 7:00pm UTC](https://pdfjs.community/t/duplicated-search-results-in-document-viewer/2548/4 "2023-05-02T19:00:10Z")

</div>

Hi there,

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

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/8/89ba08c19a1221f2e809e225f340f37597d9301d.jpeg)

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

Best regards,  
Kevin Kim
