Search in Multiple Documents / Multiple Formats


#1

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.


#2

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.

#3

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 https://github.com/richardbryceau 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…


#4

Yes, it is possible too.
But unindexed search in 1 Tb hard drive will take a looooooooooooot of time… :slight_smile:


#5

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.


#6

Is something like grep out of the question?


#7

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


#8

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).


#9

Not sure how long would i take but for searchable PDF files you can use QuickPDF Library to extract text and then search it


#10

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


#11

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.


#12

Hi Didier

Do they have an API to do that from my NetTalk program?

Thanks

Nardus


#13

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 …


#14

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: