Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2009 at 15:56 UTC
Updated:
10 May 2010 at 17:10 UTC
Firstly, thank you for all the work that has been going into this module - what a fantastic replacement for the core search!
Secondly, I would like to add images to the display of (some) our search results without having to consult MySQL at all. In order to so, would I need to add the actual 'filename' for the content type $node->field_playerimage[0]['filename'] to schema.xml:
<field name="filename" type="text" indexed="false" stored="true"/>
And then add them to the 'fl params?' (Where do I edit the 'fl params?'
Thank you again!
Comments
Comment #1
robertdouglass commentedfl can be modified using
function alzsearch_apachesolr_modify_query(&$query, &$params, $caller) {
You can also add stuff to be indexed using something like this:
Comment #2
reinholdlange commentedrobertDouglass - this worked like the charm. The image field was indexed and is accessible via the Solr admin page (in the XML output. One remaining question is how would I display this field:
in the search results?
Thank you once more!
Comment #3
robertdouglass commentedFor that you need to theme the search results using theme('search_result') http://api.drupal.org/api/function/template_preprocess_search_result/6
In the override you munge the field name back (field_playerimage) and use content_format('field_rm_category', $fieldvalue); to display it.
The whole document (including the cck field that has been indexed) should be in the search results. Here's the pertinent code from apachesolr_search_process_response:
So you can see that there is a drupal_alter for you to hook into, as well as the 'node' key in the search result.
By the way - the DRUPAL-6--2 branch is more developer friendly. This code I've pasted is from DRUPAL-6--2 and might not work on DRUPAL-6--1. I'm changing the version and component of the issue to reflect this.
Comment #4
reinholdlange commentedrobertDouglass - thank you ever so much for taking the time to reply. This is really exciting stuff and I am pleased to be learning about it. - I am however not able to find the image field (field_playerimage) in the search results array...?
Thank you very much!
Comment #5
jpmckinney commentedFor ss_field_playerimage to show up in the search result array, you must add it to the fl parameter:
You can then access it in search-result.tpl.php at: