[Feature] Improving Search Functionality
Is your feature request related to a problem? Please describe.
I often find it frustrating when performing searches in lengthy PDF documents, as a search is executed for each character typed in the search box. This leads to multiple unnecessary searches for a single word, which is time-consuming and inefficient.
Describe the solution you'd like
I would like the search functionality to be modified so that it only executes the search after the Enter key is pressed. This change would allow users to type out their queries without triggering multiple searches, thereby improving the overall efficiency of the search process.
Describe alternatives you've considered
I have considered alternative solutions, such as implementing a delay before executing the search, allowing users to finish typing before the search begins. However, I believe that waiting for the Enter key press is a more straightforward and user-friendly approach.
Additional context
This improvement would greatly enhance the user experience when searching through lengthy PDF documents. Thank you for considering this feature request.
duplicate but need to search inefficiently through github one at a time related ? https://github.com/sumatrapdfreader/sumatrapdf/discussions/4001 https://github.com/sumatrapdfreader/sumatrapdf/issues/2302
Hmm nearest equivalent is the oldest https://github.com/sumatrapdfreader/sumatrapdf/issues/154
If you double click a current word and press / it will seed the find box with the selection
basically inside a PDF internals all words are one byte character long and thus a string to search is a combination of adjacent characters this is why a word search is highly complex and needs code to allow for alternative e.g. CASE or foreign characters like ² or µ ¥ etc. For one of several common issues see https://github.com/sumatrapdfreader/sumatrapdf/issues/2963
@ryanlo713 I have adapted a VBS command to allow for phrase searching NOTE it is a Beta ADDIN that will need to be placed in a suitable user folder. I personally store mine in a PLUS folder under username as shown.
cut and paste as Finder.vbs
'This script is Designed as a "Plus" addin for SumatraPDF to aid with SEARCH entry
'It can be used for "Drag'n'Drop" a PDF on Finder.VBS or for ExternalViewers expansion in advanced settings
' IMPORTANT In the example CommandLine below ensure the location of the VBS is changed to your own location
'ExternalViewers [
' [
' CommandLine = "C:\Users\user name\AppData\Local\SumatraPDF\plus\Finder.vbs" "%1"
' Name = &Search
' Filter = *.*
' Key = S
' ]
']
'
'you can also add in pre-release a Menu Shortcut
'
'Shortcuts [
' [
' Cmd = CmdFindNextSel
' Key = s
' ToolbarText = Find>
' ]
']
'
'Above lines that start with ' are comments that can be deleted in a working copy
Dim objShell,strMessage
Set objArgs = Wscript.Arguments
Set objShell = WScript.CreateObject("WScript.Shell")
strMessage =Inputbox("Enter String","Find Word(s)")
objShell.Run("""C:\Program Files\SumatraPDF\SumatraPDF.exe""" & " -reuse-instance -search " & """" & strMessage & """" & " " & """" & WScript.Arguments(0) & """")
It can be used internally as a key command OR If you drag a PDF onto the VBS or use via a desktop shortut it works "standalone"
One oddity you may note is the find box does NOT initially show the searched phrase but click find> next will show it.
Internally Press S key or use ALT F (file menu)
Thank @GitHubRulesOK for sharing! This add-in is enjoyable and functions well. On a different note, is there a page that lists other publicly shared add-ins?
@ryanlo713 I wrote many over the years in forums for various problems but many have become redundant as SumatraPDF has been continuously updated.
Newer ones such as this one I am adding to https://github.com/GitHubRulesOK/SumatraPDF-Plus/tree/master/Plus and some older (perhaps more complex) are found at https://github.com/GitHubRulesOK/MyNotes/tree/master/AppNotes/SumatraPDF/Addins
How is this time-consuming please?
It will take about 5-10 seconds to input each character
I reproduced it. Continuously inputting characters while the search is in progress will trigger it, especially if you accidentally type a wrong character, then find the error and try to delete it, which will continuously trigger the search execution.
https://github.com/user-attachments/assets/5438d863-d8c4-4435-96bc-3340004518b3