Linux Index Search File Algorithms

I am thinking of implementing a file finder using indexing in linux ... I know that there are several other file finders, such as beagled. but I do it for the purpose of training ... I am amazed at how to do indexing. I have the following idea that I took from the maemo-mapper application. for example, if u has a file named "suresh" its index in the file system is in the form of files ...

/home/$USERNAME/.file_search_index/s/u/r/e/s/h/list.txt .. This list.txt file contains the location of all files with the name = "suresh" ... Pls offers a better idea / algorithm for its implementation ... And if there is any material on various file search methods, send it ....

+3
source share
2 answers

Have you not seen the locate command that comes with findutils ? Like the beagle, it is free software, so you can learn the code.

The findutils package is always looking for contributors.

Information about the database format is at http://www.gnu.org/software/findutils/manual/html_node/find_html/Database-Formats.html

+4
source

Beagle takes a very interesting approach with inotify. It starts, sets the clock in the parent directory, and starts another thread that performs a recursive scan. As you access additional directories, the parent sees them and adds more hours, watching what he already knows.

, , ( ) . .

, . FS , , "updatedb".

, . stat() . some-very-long-shared-object-name.so.0, , stat() . SQLite3.

- , PCI ( ) .

+1

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


All Articles