Return search results compatible with indexing of subdirectories
| Project: | Swish-E Indexer |
| Version: | 4.7.x-1.4 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
The module assumes that all the indexed files are located at the main level of the file upload directory, while Swish-e is able to go to subdirectories and even symlinks (if so instructed in the .conf file).
So, if Swish-e indexes a subdirectory of e.g. /files, the search results show the filename for those files but the path is always "flattened" to the first level of the /files directory, which originates lots of 404.
I've edited this way the generation of $link inside swish_search().
Before:
$link = file_create_url (variable_get('file_directory_path', 'files').'/'.$basename);
After:
$link = (str_replace($_SERVER["DOCUMENT_ROOT"], "", substr($result, $k+1, $i-$k-1)));
There's maybe a safer and cleaner way, but I'm just throwing it in as a suggestion.
