PrizmDoc Hybrid Viewing: Reduce server viewing requirements and streamline document processing
Read More
Enable your employees to remain productive throughout the document management process.
Learn how SmartZone uses a regular expression engine integrated into the recognition engine to achieve the best possible accuracy on data that can be defined by a regular expression.
The tale of how an underdog is going head-to-head with a tech giant (and winning).
With PrizmDoc, how can I hide a predefined search if there are no results?
The predefined search option does not support that functionality, but you can instead perform a server-side search, and then activate the search panel if there are results to show:
var viewer; var viewingSessionId = <%= viewingSessionId %>; var fixedSearchTerm = "the"; var pasUrl = "/pas"; var viewerReady = false; var searchReady = false; var searchDisplayed = false; function displaySearchIfNeeded() { // The search is only displayed once the viewer is ready, and once our preliminary server-side search comes back positive. if (viewerReady && searchReady && !searchDisplayed) { searchDisplayed = true; $("[data-pcc-search=\"input\"]").val(fixedSearchTerm); $("[data-pcc-search=\"submit\"]").click(); } } function sendSearchPost() { $.ajax({ "method": "POST", "url": pasUrl + "/v2/viewingSessions/" + viewingSessionId + "/searchTasks", "data": JSON.stringify({ "input": { "searchTerms": [ { "type": "simple", "pattern": fixedSearchTerm, "caseSensitive": false, "termId": "0" } ] } }), "contentType": "application/json", "success": function(response) { $.ajax({ "url": pasUrl + "/v2/searchTasks/" + response["processId"] + "/results?limit=1", "success": function(response) { if (response.results.length !== 0) { searchReady = true; displaySearchIfNeeded(); } }, }); }, "error": function(jqXHR, textStatus, errorThrown) { if (jqXHR.status === 480) { setTimeout(sendSearchPost, 2000); } } }); }; setTimeout(sendSearchPost, 500); $(document).ready(function() { // Since we are no longer restricted to a predefined search, we can load the viewer ASAP. viewer = $("#viewer").pccViewer({ "documentID": viewingSessionId, "imageHandlerUrl": "/pas", "language": viewerCustomizations.languages["en-US"], "template": viewerCustomizations.template, "icons": viewerCustomizations.icons }); viewer.viewerControl.on("ViewerReady", function(event) { viewerReady = true; displaySearchIfNeeded(); }); });