C# coding question on search within files RRS feed

  • Question

  • hello.

    I'm trying to find a code that allows admin to search for keywords within numerous files 

    i'd actually love an explanation about how to do it :)

    the search for filename is easy, but actual keywords within the file?

    Thanks a lot.


    vendredi 11 décembre 2020 16:53

Toutes les réponses

  • Unfortunately, there is no "easy" way to do this. You need to open one by one each of the files and examine their whole content looking for the keywords.

    If you need to speed it up, you can use a facility that is provided by the Windows operating system. You can tell it to index the content of the files under a specific directory or sets of directories. This, internally, reads the whole content of each of the files, splits it into words, and keeps a database of words and the files in which they are found. It does not save any "total" processing time, but it works in the background when files are added to the folders. Then, you can query the database at any time to get a quick result about which files contain the keywords that you are seeking.

    Windows Search Overview.

    samedi 12 décembre 2020 11:16
  • ISearchFolderItemFactory interface

    works fine, but it is localized (for content:xxx, I need to write contenu:xxx on my french OS for IQueryParser)

    samedi 12 décembre 2020 12:03