Anyone here did anything with Windows Search Service APIs or do you have a solution/suggestion on how to search for keywords in multiple documents and multiple formats.
Yes, it is possible, but not simple.
- Windows Search works only in indexed folders, included in one of the special Libraries (Documents, Music, Video etc.). LIBRARIES, but NOT folders! This means, you must include your folders in one of these libraries.
- Windows Search uses ADO.
- You must use this connection string:
ConnectionString=âProvider=Search.CollatorDSO;Extended Properties=âApplication=Windowsââ - Query example:
âSELECT System.ItemPathDisplay FROM SystemIndex WHERE SCOPE=ââfile:â & CLIP(LEFT(PATH())) & â\DOCSâ & âââ and CONTAINS(ââ"â & CLIP(LEFT(GLO:SEARCH_STRING)) & â*"ââ)â - See MSDN and Clarion Help for details.
Thoughts in replyâŚ
I note that Search is an option from the standard windows Shell Execute Windows api function. I have a very basic full clarion code example of this working in test only⌠but not posted here richardbryceau (Richard Bryce) ¡ GitHub unfortunately⌠prehaps i can get this example updated later this weekâŚ
SELECT System.ItemPathDisplay FROM SystemIndex
Searching on âmssql SystemIndexâ or âsystemindex powershellâ in Google is returning some interesting resultsâŚ
Yes, it is possible too.
But unindexed search in 1 Tb hard drive will take a looooooooooooot of timeâŚ
Thanks Constantine.
When you say " This means, you must include your folders in one of these libraries." I want to save files into a folder on the PC - when I do that how do I include them in a library?
I am using ADO for Single Sign On to Active Directory so that should not be too difficult.
Is something like grep out of the question?
Hi Jeff
Not sure that will work. I need to search hundreds if not thousands of files that can be word or pdf format.
Thanks
Nardus
Hi, Nardus!
Now it became clearerâŚ
So, letâs clarify what do you want: to search files on mask (*NAME?.PDF) or to search any files containing preassigned text.
In first case ShellExecute with âfindâ verb will be much more faster.
In second case you should use Windows Search.
There are two ways to add folder to library: you can do this manually or programmatically.
To add folder manually:
- Launch Windows Explorer.
- Select folder.
- Right-click on it.
- Select item like âAdd to libraryâ (sorry, my Windows is Russian⌠).
- Select library.
To add folder programmatically:
You should use IShellLibrary interface (https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishelllibrary).
Not sure how long would i take but for searchable PDF files you can use QuickPDF Library to extract text and then search it
I have been using Copernic Desktop for the past 10 years for that.
It scan all drives even on a network. and report for the words you are looking for in all kind of format.
Reports from emails, txt pdf pictures , anything
Didier
Hi Constantine
I would need to be able to search . (word and pfd) in a specific folder for an unlimited number of keywords supplied by the user, so I would guess windows search is the way to go.
Thanks for the explanation on how to add the folder to a library.
Hi Didier
Do they have an API to do that from my NetTalk program?
Thanks
Nardus
I donât know. You could check their web site.
Didier Le Duc
âLâhomme sage ne joue pas Ă saute mouton avec une licorne.â
Lao Tse âŚ
Hi, Nardus!
Iâm working on the same problem now. But I need to search both in local and network folders. It is quite differentâŚ
So, will you post a report about your results here?
Iâm interested.
Thanks!
P.S. If my posts are helpful for you, you may use âLikeâ buttonâŚ