After clearing search text, search result showing previous value

Hi Team
After clearing search text, search result showing previous value
For Example: I am searching text “to”. search result showing 8 but I am removing search text. it showing 8 result.

PDFtron/Webviewer= 7.1.2
Framework : angular 11

WebViewer({ … }, viewerElement).then(instance => {
const { annotManager, docViewer, Annotations } = instance;

const searchListener = (searchPattern, options, results) => {
// add redaction annotation for each search result
const newAnnotations = results.map(result => {
const annotation = new Annotations.RedactionAnnotation();
annotation.PageNumber = result.pageNum;
annotation.Quads = result.quads.map(quad => quad.getPoints());
annotation.StrokeColor = new Annotations.Color(136, 39, 31);
return annotation;
});

annotManager.addAnnotations(newAnnotations);
annotManager.drawAnnotationsFromList(newAnnotations);

};

docViewer.on(‘documentLoaded’, () => {
const searchPattern = ‘text to search’;
// searchPattern can be something like “search*m” with “wildcard” option set to true
// searchPattern can be something like “search1|search2” with “regex” option set to true

// options default values are false
const searchOptions = {
  caseSensitive: true,  // match case
  wholeWord: true,      // match whole words only
  wildcard: false,      // allow using '*' as a wildcard value
  regex: false,         // string is treated as a regular expression
  searchUp: false,      // search from the end of the document upwards
  ambientString: true,  // return ambient string as part of the result
};

instance.addSearchListener(searchListener);
// start search after document loads
instance.searchTextFull(searchPattern, searchOptions);

});
});

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello there.

Thanks for reaching out.

This is the expected behavior. The search is only actually triggered when the search button is clicked, then it will take the search input value and use it as the input.

Let me know if you have any further questions.

Best Regards,
Diego Felix
Web Software Developer
PDFTron Systems, Inc.
www.pdftron.com

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.

Hi,

After clicking the search button also, it is showing the previous search result.

Hello there.

I really can’t reproduce this issue on WebViewer 7.3. Would upgrade your WebViewer version to 7.3 be possible? Maybe this was an issue that is already solved.

Best Regards,
Diego Felix
Web Software Developer
PDFTron Systems, Inc.

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.