Indexing files and a quick way to find a file in folders?

I have 660,000 xml files (with unique file names) in 22 folders. Each folder has 30,000 files. I need to find them by name efficiently in a C # application. I know there is a SearchIndexer service on Windows (? Vista +?), And I'm just wondering if I can use this or do I need to index the files myself?

Alternatively, I think I could create a database with the file name being the primary key and path in another column. However, should I create one table with 660,000 rows in it or 22 tables with 30,000 rows each? And why?

Thanks in advance.

+3
source share
2 answers

(NTFS), , 30 000 . , , .

, 0 660000. :

00/
  00/
    <99 files that hash here>
..
65

"", , . :

Lookup(string filename)
{
   int hash = filename.GetHashCode() % 660000;
   string directory = HashToDirectory(hash);
   string path = Path.Combine(directory, filename);
   ...

, , , "" . HashToPath. .

-, . NTFS, YMMV.

+2

:

  • SQL AQS
  • ISearchQueryHelper
  • -ms
  • SQL Search SQL
  • Programmatically
+1

Source: https://habr.com/ru/post/1760952/


All Articles