In some cases, search result links can point to files. i.e. when using the apachesolr_attachments module.

I found that such results were not correctly outputting the url of the private filesystem access (/system/...).

The attached patch corrects this.

The patch is only changing one line if apachesolr_search.module

-        'link' => url($doc->path, array('absolute' => TRUE)),
+	'link' => $doc->url,

Comments

pwolanin’s picture

Status: Needs review » Needs work

No, it uses path on purpose. url is there for multi-site search use.

You need to explain the bug in much more detail. What's you've provided is not enough to even understand the bug. How are you indexing files?

drasgardian’s picture

The files are filefields with the upload destination set to private.

I'm using apachesolr_attachments to index them and I'm extracting content from the documents using the remote solr server.

Without the patch, the search results (the ones that link to documents rather than nodes) link to the absolute filesystem path of the documents.

If this wasn't the correct way to correct the problem though, I expect I should be re-posting the issue to the apachesolr_attachments module issue list.

pwolanin’s picture

Project: Apache Solr Search » Apache Solr Attachments

Yes, file-related problems should be handled in the attachments module.

Monty-2’s picture

Status: Needs work » Needs review
StatusFileSize
new364 bytes

The attached patch replace the link with the url of the file $doc object.

nick_vh’s picture

nick_vh’s picture

Status: Needs review » Closed (duplicate)