mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 19:47:43 +01:00
This commit implements the file search extension for Windows platforms using the [Windows Search](https://learn.microsoft.com/en-us/windows/win32/search/-search-3x-wds-qryidx-overview) functionality. Something to note: 1. Searching by file content is not natively supported. Coco would search for all the columns (attributes/fields within the index) with this option: ```rust SearchBy::NameAndContents => { // Windows File Search does not support searching by file content. // // `CONTAINS('query_string')` would search all columns for `query_string`, // this is the closest solution we have. format!("((System.FileName LIKE '%{query_string}%') OR CONTAINS('{query_string}'))") } ``` 2. Tests have been added, but they failed in our CI for unknown reasons so I disabled them: ```rust // Skip these tests in our CI, they fail with the following error // "SQL is invalid: "0x80041820"" // // I have no idea about the underlying root cause #[cfg(all(test, not(ci)))] mod test { ``` 3. The Windows Search index is not real-time and can return obsolete results. Opening the returned documents could fail if the chosen file has been deleted or moved.