To display attachments in search results, upload.module implements hook_nodeapi with 'search result' operation. Then it reads $node->files.

In apachesolr_search.module, at line 238, there is a call to node_invoke_nodeapi($doc, 'search result'), but $doc doesn't seem to be a full filled node, thus, upload.module can't display how many attachments a search result has.

This may be an issue for othe modules implementing hook_nodeapi($node, 'search result').

Comments

David Stosik’s picture

Adding

$node_data = node_load($doc->nid);
foreach ($node_data as $key => $value) {
  $doc->$key = $value;
}

before node_invoke_nodeapi, would be OK.
But it needs to node_load each search result...

pwolanin’s picture

If you want to display this info - it would be better to do it at index-time, rather than at display time.

Othersie you do indeeed need to do a node load on each node - though this may already be ahppening since we are calling hook_nodeapi.

David Stosik’s picture

Othersie you do indeeed need to do a node load on each node - though this may already be ahppening since we are calling hook_nodeapi.

Seems it's not happening, as adding the lines I pasted here actually worked! ;)

pwolanin’s picture

Ah, we may be exeuting a node load- I did not mean to imply that we were adding all the node data to the doc.

lisarex’s picture

This has been added to the Redesign project #660572: Meta issue for Apache Solr Search Integration

robertdouglass’s picture

We want to avoid node_load. We're not doing it now and it would be catastrophic to performance to add it. We need to index the information that upload module expects to have.

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new2.14 KB

something like this.

pwolanin’s picture

Status: Needs review » Needs work

we should probably take into account file filed and image field, etc.

Perhaps this code should be in apachesolr_attachments?

csevb10’s picture

Status: Needs work » Needs review

My vote would be that apachesolr handles core modules (only to replicate node_load related functionality), lets external modules handle their own indexing/values via the api, and provides roll-up metrics via something like apachesolr_attachments (i.e a count of filefield + imagefield + upload files if desired).

RD: Do you have thoughts on this? How would you like to handle functionality for core modules like upload?

csevb10’s picture

Status: Needs review » Needs work

Whoops. Modified status.

drumm’s picture

Issue tags: -drupal.org redesign

Which page at https://infrastructure.drupal.org/drupal.org-style-guide/prototype.html shows this being used in the redesign?

pwolanin’s picture

Looking at this:

https://infrastructure.drupal.org/drupal.org-style-guide/prototype/searc...

if we have api.d.o, docs.d.o, etc then each of the top right facets on that page would be a site within the multisite search.

My recollection, however, is that the multisite aspect of search is not very explicit in the design, but is pretty clearly needed as we split more content among subdomains.

drumm’s picture

Title: Attachments are not displayed in search results » Attachment count is not displayed in search results
Issue tags: +drupal.org redesign

Oh, I read this as something having to do full attachments. A simple count is good.

pwolanin’s picture

Not sure what the tactic is here - the code to find filefield attachments is already in apachesolr_attachements, but I'm not sure if thoe show up in the count displayed by core search?

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new1.73 KB

Slightly improved version of #7. Since core node search doesn't show filefiled files, maybe we should just KISS.

pwolanin’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

committed to 6.x-1.x, needs to be ported to other branches. (patch doesn't apply cleanly to 6.x-2.x)

robertdouglass’s picture

Status: Patch (to be ported) » Fixed

#373824 by pwolanin | David Stosik: Fixed Attachment count is not displayed in search results.

Status: Fixed » Closed (fixed)
Issue tags: -drupal.org redesign

Automatically closed -- issue fixed for 2 weeks with no activity.