Search in Multiple Documents / Multiple Formats

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.

  1. 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.
  2. Windows Search uses ADO.
  3. You must use this connection string:
    ConnectionString=‘Provider=Search.CollatorDSO;Extended Properties=“Application=Windows”’
  4. Query example:
    ‘SELECT System.ItemPathDisplay FROM SystemIndex WHERE SCOPE=’‘file:’ & CLIP(LEFT(PATH())) & ‘\DOCS’ & ‘’’ and CONTAINS(’’"’ & CLIP(LEFT(GLO:SEARCH_STRING)) & ‘*"’’)’
  5. See MSDN and Clarion Help for details.
1 Like

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… :slight_smile:

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… :slight_smile:
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:

  1. Launch Windows Explorer.
  2. Select folder.
  3. Right-click on it.
  4. Select item like “Add to library” (sorry, my Windows is Russian… :slight_smile: ).
  5. 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).

1 Like

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… :frowning:
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… :slight_smile:

1 Like