cozy / cozy-libs

Libraries used to build Cozy products and tools.
MIT License
7 stars 12 forks source link

[PRD-609] Allow search on name and path #2612

Closed paultranvan closed 2 weeks ago

paultranvan commented 2 weeks ago

Say you have a "Foo" directory with a "bar.txt" in it. Let's assume this bar.txt is duplicated in many locations. You want to search specifically for it by typing "Foo bar". It wasn't possible before because of how flexsearch works: it searches by indexed attributes, here the path and the name. In this example, "Foo bar" will not match the name, neither the path.

As a workaround, we now force the path computing at indexing time for all files. This path is not persisted in PouchDB, as the stack does not store it for files (but it does for directories). Note that even though the stack returns the file's path when we query it, we need to add the file name, as it does not include it.